In CrimeFragment, i am using android.app.Fragment with a LinearLayout that contains one android.widget.EditText inside it and i dont have landspace layout folder. A android.text.TextWatcher is added to the EditText via addTextChangedListener. Say i enter a letter “a” into the EditText and i rotate the android device. I would expect the existing Fragment to be completly destroyed and a new instance of Fragment to be created. Also, i expect the EditText to be empty in the new Fragement. But to my surprise, following happens:-
1.Both Fragment and its containing Activity are completely destroyed
2. A new instance of Fragment and Activity are created. So far good. this is per my expectation.
3. BUT, the last events on EditText are replayed. The last events were beforeTextChanged() and onTextChanged(). How is this possible? If a new instance of fragment is created, this would imply a new instance of EditText is created, then who is reposible for replaying the last events on EditText?