Darrell Brogdon
Darrell Brogdon

Reputation: 6973

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 to fire another Activity that installs it.

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

Upvotes: 0

Views: 105

Answers (2)

Andrew
Andrew

Reputation: 41

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).

Upvotes: 1

MByD
MByD

Reputation: 137272

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

Upvotes: 2

Related Questions