我的應用程序是一種信息應用程序,所以我必須定期更新它。但是,如果我要這樣做,那麼用戶定期下載或更新它將不方便。如何在沒有用戶許可的情況下每日更新?如何每天在我的應用程序中更新內容而不要求用戶每天下載和更新?
<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文件。
這個問題過於寬泛,但您真正需要的是將您的UI與數據分開。把你的信息放在一個數據庫中,在上面寫一個Web服務/ API層,把它放在可以通過互聯網訪問的地方,然後把你的UI連接到服務上。您更新數據庫中的數據,所有用戶都可以看到更改,而無需下載新的應用程序。如果數據足夠小或足夠簡單,則可以將所需的信息放在Internet/Internet上的某個XML/JSON /文本文件中,然後更新應用程序以從該文件中讀取數據。 –
sry bt我不明白 –
有一種叫做SyncAdapter的東西。你應該嘗試使用它。 –