Reputation: 5987
I have in fragment two of my own widgets. These widgets have edit text and textview. If i write something to bottom edit text and rotate display, text appears in both edit texts. If i write text to upper edit text and rotate display, text dissapear. I think that this is caused because that edit texts have same ID. Is there any better solution than save texts from both edittexts and restore it on m yown?
Upvotes: 1
Views: 1355
Reputation: 1373
you can also put this in your manifest.xml
android:configChanges="orientation"
Upvotes: 0
Reputation: 7585
Yes.
You need to override onSavedInstanceState(Bundle state)
and save the values of your view to that state
bundle.
Then, in onCreate
or onRestoreInstanceState
repopulate your views from the value of the bundle passed in the two aforementioned methods. Your views are sometimes likely to repopulate but this is not always the case.
Upvotes: 1