how do you implement a wizard-like interaction in android? [duplicate]
Possible Duplicates:
Make a wizard like application in Android Pattern one activity, multiple views. Advantages and disadvantages.
Hi, i'm ne开发者_JAVA百科w to android development and have a basic question.
suppose i want to implement a wizard-like interaction involving several interactions with the user where in each interaction i want to display a page of information to which the user responds, and move on to the next page to get some more information from the user (each page may have its own menu) until the user goes through all the pages of the 'wizard'. the question is, in android, can the wizard and all of its various pages be a single activity or does each page of information need to be a separate activity?If you want to stick with using only 1 Activity, then I recommend checking out the ViewFlipper widget, it'll be useful.
You could also utilize the new Fragment framework. On 3.0, you can use it right away. Below that, you have to use the static lib Google just released, with which you can use Fragments from Android version 1.6 and up. This way, you could use only 1 Activity, and assign a Fragment for every wizard-step. Then, you only have to switch the fragments accordingly. They even have a separate Fragment-stack. And the code'll be clean.
Seeing this each "page" should be a separate activity, since this would lead to much cleaner code (easier to maintain). However, if two of the "pages" are very closely linked, a single Activity may help to cut down on class interactions.
Technically, any application "could" be a single activity. Whether or not it should be is another story. From the sounds of your post I would start with a single activity, but you haven't given much info on what will be in that activity, so it is tough to say for sure.
精彩评论