开发者

Android | AppWidget -Config Activity | Long running task

开发者 https://www.devze.com 2023-03-30 04:30 出处:网络
I am developing an android app (only Widget) which displays some images from a remote location- say picasa or flickr.

I am developing an android app (only Widget) which displays some images from a remote location- say picasa or flickr.

So retrieving these images and preparing a bitmap from these resources is a long running task, for which i have written a service as suggested in android documentation.

I have developed this part and it is working fine.

The problem i am facing is with the Configuration Activity. The Configuration Activity has a button. When you click on the button the configuration for the widget is saved.

Now what i want is when i click on the button ConfigActivity should be finished but at the same time there a call should be made to update the widget asynchronously.

Whats the best approach to do this. - Should i make a call to onUpdate method of the WidgetProvider. - Start AsyncTask in the activity - Someth开发者_StackOverflowing else

Thanks


Start an AsyncTask and then call AppWidgetManager.updateAppWidget from that AsyncTask. See this for detail.

0

精彩评论

暂无评论...
验证码 换一张
取 消