Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android setup activity with multiple "steps"

I will explain what I want to achieve by this image:

enter image description here

When someone starts the app for the first time, setup activity will open and I want it to have multiple steps. I guess creating activity for each part of the setup is not the best solution. I would prefer if the activity would just transform to the part 2 without any animation or with a sliding animation and I want it to only change the setup part by pressing the buttons. What's the best / easiest way to achieve this? Thanks for any answers.

like image 762
Ladas125 Avatar asked Oct 03 '15 18:10

Ladas125


People also ask

Can you use a same xml layout for 2 different activities?

Yes you can! I had multiple activities inflate the same layout but they save different shared preferences.

What is an embedded activity?

Activity embedding enables you to display activities in a variety of ways. Your app can split the task window by launching two activities side by side simultaneously: Figure 2.


2 Answers

I would use a ViewPager with a FragmentStatePagerAdapter. Each step is a Fragment. To disable the swipe gesture subclass ViewPager and override OnTouchEvent

like image 130
Blackbelt Avatar answered Oct 01 '22 19:10

Blackbelt


What's the best / easiest way to achieve this?

Use an existing library for this. Depending on the role of this UI, ProductTour might be appropriate, and if not, one of the wizard libraries probably is.

like image 36
CommonsWare Avatar answered Oct 01 '22 21:10

CommonsWare