I'm saving the content of my EditText on rotation as
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putString("editTextText",mEdittext.getText().toString());
}
And in my onActivity created I'm trying to reset it to the previous value as
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mContext = getContext();
View mView = getView();
if (mView != null) {
mEdittext = (EditText) mView.findViewById(R.id.editt_fragPend);
if(savedInstanceState!=null){
String savedText=savedInstanceState.getString("editTextText","");
mEdittext.setText(savedText);
}
}
}
I debugged the above code the value of "savedText" indeed is the value I stored in onSaveInstanceState but after setting it to the editText. It still shows up blank. I have no other code that meddles with the editText.