2017-02-06 62 views
-1

我的應用程序是一種信息應用程序,所以我必須定期更新它。但是,如果我要這樣做,那麼用戶定期下載或更新它將不方便。如何在沒有用戶許可的情況下每日更新?如何每天在我的應用程序中更新內容而不要求用戶每天下載和更新?

<TextView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:textAppearance="?android:attr/textAppearanceLarge" 
    android:text="1.LUNCH- Rajma Chawl,Beans,Halwa,Raita,Roti."//want to update this section 
    android:textSize="25dp" 
    android:id="@+id/textView2" 
    android:textColor="#ffffff" 
    android:layout_below="@+id/textView" 
    android:layout_alignParentLeft="true" 
    android:layout_alignParentStart="true" 
    android:layout_marginTop="58dp" /> 

<TextView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:textAppearance="?android:attr/textAppearanceLarge" 
    android:text="2.Dinner- Rajma Chawl,Beans,Halwa,Raita,Roti."//want to update this section 
    android:textSize="25dp" 
    android:id="@+id/textView3" 
    android:textColor="#ffffff" 
    android:layout_below="@+id/textView2" 
    android:layout_alignParentLeft="true" 
    android:layout_alignParentStart="true" 
    android:layout_marginTop="58dp" /> 

我必須定期更新這個XML文件。

+0

這個問題過於寬泛,但您真正需要的是將您的UI與數據分開。把你的信息放在一個數據庫中,在上面寫一個Web服務/ API層,把它放在可以通過互聯網訪問的地方,然後把你的UI連接到服務上。您更新數據庫中的數據,所有用戶都可以看到更改,而無需下載新的應用程序。如果數據足夠小或足夠簡單,則可以將所需的信息放在Internet/Internet上的某個XML/JSON /文本文件中,然後更新應用程序以從該文件中讀取數據。 –

+0

sry bt我不明白 –

+0

有一種叫做SyncAdapter的東西。你應該嘗試使用它。 –

回答

0

你可以自動更新,你必須在後臺進程中更新..做服務。做一些聲明每天檢查然後在後臺做服務。

+0

但如何做到 –

+0

請注意,我們寧願海報在這裏使用真實的單詞。你的英語不一定是完美的,但如果像「你」這樣的詞語輸入太麻煩,Stack Overflow可能不適合你。 – halfer

+0

對不起,我的錯誤。感謝您的意見 –

相關問題