How to Resume Activity from Previous state after handling Incoming Call in Android?
I am creating app that download 4-5 images from server and display as gallery. It working fine in normal condition. but when there is incoming call or device is in sleep mode my activity load data from starting after onResume, i am not able to开发者_JAVA技巧 load data(Resume activity) from previous state of activity.
Is there any soulution?
Thanks
You should read how to handle runtime changes.
Basically, under some situations your Activity will be recreated. To preserve state you can pass objects between old and new Activity, using onSaveInstanceState()
in old activity and onRestoreInstanceState()
in new activity.
Check out Saving Cache Files. Save your images on pause and restore them on resume.
You should probably cache the files, so it works like this, check if files already exist, if not download, when files exist load pictures,
http://developer.android.com/guide/topics/data/data-storage.html#ExternalCache
精彩评论