How to use actions or fragments in a multiscreen workflow?

I have a multi-screen workflow with different questions and answers. Thus, a question arises on screen 1, and the user makes his choice → the user clicks the “Continue” button → screen 2 opens with another question → the user makes his choice and continues → screen 3 opens, etc.

But in fact, I'm not sure that this is the best way to implement this behavior, taking into account good maintainability and clarity. I think they have at least three options:

  • Each screen receives its own activity and layout file, and I pass the selected data targets.

  • 1 Activities and different fragments, each fragment has its own layout. If you click the continue button, the fragment will be replaced by the next fragment.

  • 1 Actions and different layout files. Just the layout is replaced, and everything else is processed in the activity.

Actually, I already started the implementation with option 2.) , but I don’t know if this is too much.

The Android API recommendations say that you should use Fragmentsfor a multi-channel interface and for reuse. But in fact, I do not want to create a multi-user interface in this case, and fragments are not reused. So maybe 3.) is this the way to go? Or even 1.)?

+4
1

№ 3. :

  • . , . .
  • . , /, / . - Google, , . , , Google.
  • , , /. /. , . , Android- . Android , .

3: inflate() . SO link @ Android,

+4

Source: https://habr.com/ru/post/1619002/


All Articles