I want to handle orientation in my android app by implementing onSaveInstanceState
. I add all the variables that I need to the bundle in the onSaveInstanceState
method and everything is ok and I can restore them in the onCreate
method of the same fragment.
The problem is although I can restore all the variables, getActivity()
has null value.
I tried adding setRetainInstance(true)
but in this case I couldn't restore the saved variables from bundle.
can anyone help me? Thanks,