2

I have two questions and your help is really appreciated

First:

is there a way to make a button in the main activity and a menu item open the same fragment from back stack without creating a new one.

Second:

how can I retain what is typed in editText in the fragment without any buttons clicked, should I use outState.putString() in the onSaveInstantState() method or somewhere else and then do I check if it existed should I do it in the onCreate() or onCreateView()?

thank you!

Volodymyr
  • 6,393
  • 4
  • 53
  • 84
Redab0
  • 27
  • 7

1 Answers1

2

First: yes, you can, just use similar code in button onClick and onOptionsItemSelected pop the fragment by name example Second: Save fragment state example

Community
  • 1
  • 1
Beyka
  • 1,372
  • 1
  • 10
  • 15