0

I have a requirement in my application. my application has 6 fragments in a Navigation drawer each fragment represents single item in navigation drawer list.

But in one of the fragment i need to implement a form which will be spread across 5 views one at a time, can any one suggest me how to approach this in android.

Initially i thought of doing this using ViewPager , but i dont need horizontal swiping but need to go to next screen when clicked on a button.

Kindly advice me how to approach this.

Thanks & Regards.

Nagendra

nagendra
  • 161
  • 1
  • 1
  • 12
  • 2
    you can implement by handling the fragment change on next button click. Every time user clicks on next or previous button change the fragment or reload new instance of same fragment with updated layout based on your desired parameter. – Rajen Raiyarela Dec 18 '14 at 06:21
  • But can i create fragments inside a fragments and the second point is i need to persist the data in all the screens until i click submit in the last screen since it is a form – nagendra Dec 18 '14 at 06:37
  • regarding creation of fragment inside fragment pl check this link http://stackoverflow.com/a/6847770/3831557. Regarding persistent data, that you have to put your own logic which you need to implement before calling fragment change call on next/previous button. – Rajen Raiyarela Dec 18 '14 at 06:59

1 Answers1

0

You can create main fragment and sub-fragments. Inside the main fragment, show the sub-fragments by replacing them, store the data by creating an entity object here and pass it to the sub-fragments. Inside sub-fragments, pass the data to the main fragment entity using listeners.

Marvs
  • 183
  • 2
  • 7