I illustrate my problem, I selected an application that performs a series of operations in quick succession the touch of a button. each action is represented by an intent to perform a load of an app in the Market or an installation of an external apk.
currently my app does it all in quick succession, but most often give error especially when the intent become many (more than 8) so I wanted to rewrite the code so that:
then there is a way to wait for the end of a first intent to continue?
On Clicking the back button from the New Activity, the finish() method is called and the activity destroys and returns to the home screen.
1.2. To start an activity, use the method startActivity(intent) . This method is defined on the Context object which Activity extends. The following code demonstrates how you can start another activity via an intent. # Start the activity connect to the # specified class Intent i = new Intent(this, ActivityTwo.
You'll typically use an explicit intent to start a component in your own app, because you know the class name of the activity or service you want to start. For example, you might start a new activity within your app in response to a user action, or start a service to download a file in the background.
Use startActivityForResult()
to start your load / installation or whatever.
Handle the back button event in the started activity to abort the running action.
When your sub-activity has completed you may evaluate the result in onActivityResult()
in your main activity.
See here for more info: http://developer.android.com/reference/android/app/Activity.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With