Android Interview Questions and Answers What is android?



Download 0.77 Mb.
View original pdf
Page35/62
Date17.12.2020
Size0.77 Mb.
#54986
1   ...   31   32   33   34   35   36   37   38   ...   62
Android Interview Questions
2. Activities And Intents
The method public abstract void startActivities(Intent[] intents) has been added to the class android.app.Content An implementation of this method will effectively start a stack of Activities with the Activity at the bottom corresponding to the first Intent in the array and the Activity at the top corresponding to the last Intent in the array. When started in this way an Activity is not created until it is actually accessed by the User For example, if an Application defines the following Activities



















and it executes startActivities( new Intent
{ new Intent("xper.intent.FOO_INTENT"), new Intent("xper.intent.BAR_INTENT"), new Intent("xper.intent.BAZ_INTENT")
}); then an instance of Baz is created and made the current Activity. If Baz finishes then an instance of Bar is created and is made the current Activity. If Bar finishes then an instance of Foo is created and is made the current Activity. The method documentation states This method throws ActivityNotFoundException if there was no Activity found for any given Intent. In this case the state of the activity stack is undefined (some Intents in the list maybe on it, some not, so you probably want to avoid such situations. which is not that helpful. What currently appears to happen in practice is that as long as the ActivityNotFoundException is caught all the Activities corresponding to the Intents before the one that cannot be resolved are started. There is no mention of whether this method plays nicely with things like the
Intent.FLAG_ACTIVITY_CLEAR_TOP flag and other of that ilk should you be sufficiently adventurous to set them in any of the given Intents.



Download 0.77 Mb.

Share with your friends:
1   ...   31   32   33   34   35   36   37   38   ...   62




The database is protected by copyright ©ininet.org 2024
send message

    Main page