开发者

How to call an activity only after a different activity has completed?

I have an Android project where I have an Activity that downloads a .APK file. After the download is complete I need 开发者_StackOverflowto fire another Activity that installs it.

How can I make the Install Activity fire only after the Download Activity is complete?


Use AsyncTask to download, and fire the new activity in onPostExecute()


While MByD is probably in correct in that you probably want to use AsyncTask for downloading, to answer your question directly, you would use a parent activity and call your downloading activity with startActivityForResult and then set onActivityResult to start the next activity when returning with some value (eg. public final static int ON_DOWNLOAD_COMPLETE = 1).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜