Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can I save the fragment? when I rotate the screen [duplicate]

Possible Duplicate:
ViewPager and fragments — what's the right way to store fragment's state?

how can I save the fragment? (It is located at the activity) When I rotate the screen, the activity being restarted, fragment is re-createdenter image description here

like image 411
Max Usanin Avatar asked Sep 04 '12 12:09

Max Usanin


1 Answers

try to use setRetainInstance(true); in your fragment's onCreate

like image 198
Berťák Avatar answered Oct 27 '22 16:10

Berťák