Home » Android » One activity change different fragments (different content)

One activity change different fragments (different content)

Posted by: admin November 1, 2017 Leave a comment

Questions:

I have 20 screens.

  • 10 screens have a searchView in the top of screen and 3 tabs under this searchView
  • 3 screens have a searchView in the top of screen and 2 tabs under this searchView
  • 2 screens have only a searchView
  • and the last 5 screens have no seachView and no tabs

So I think to do the next:

Create one global main activity that will be change fragments.

Questions:

  1. Is it possible in Android? I don’t want to get out of memory
  2. Is it possible to write method that will return fragment with one of the next items:

    • create fragment only with N tabs
    • create fragment only with searcView
    • create fragment with N tabs and searchView
    • create fragment without tabs and without searchView

is it possible?

Answers: