D
D
Denis Bondarenko2017-06-27 15:47:36
Android
Denis Bondarenko, 2017-06-27 15:47:36

How to switch between windows of an android application using the menu?

Friends, a question has arisen that is not really covered in any online tutorial: how to switch between windows using the menu?
So far, there are 3 options in my head.
Option 1: each window = Activity, copy-paste the menu in each Activity, i.e. onCreateOptionsMenu and onOptionsItemSelected methods. The option is clearly unnecessarily verbose, although it is working.
Option 2: see option 1, but arrange the menu as a separate class and inherit Activity from it. I don't really understand how to implement this.
Option 3 to do with the help of fragments, I also don’t really understand it yet.
More options?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
IceJOKER, 2017-06-27
@Mad_Electron

BaseActivity-> performs general functions (in your case, displays and processes the menu)
, etc.

D
Denis Zagaevsky, 2017-06-27
@zagayevskiy

Fragments. In general, there is no such UI pattern in android, why do you need it?
How exactly fragments - smoke mana and ask specific questions.
All options with activation are from the evil one.

A
Alexander, 2017-06-27
@NeiroNx

There is also a DialogFragment - it is convenient when you need to open an additional window and see something there or set settings.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question