I had
Fragment A
already addToBackStack()
.
Fragment B
not addToBackStack()
.
When Im in Fragment A
. I can detect change orientation by using onSaveInstanceState
& onViewStateRestored
method.
But I can not be successful when I'm in Fragment B
. I tried to detect change orientation by using onSaveInstanceState
& onViewStateRestored
method also but not worked.
It means It always detect change orientation in Fragment A
although I'm in Fragment B
. (Can not recognized changed orientation in Fragment B
)
People who know how I can detect change orientation in Fragment B
without detect change orientation of Fragment A
in this case?
Please help me,
Thanks,
p/s : The following code detail how to transfer from Fragment A
to Fragment B
getFragmentManager().beginTransaction()
.replace(R.id.fr_content_activity_fitness, mFm)
.commitAllowingStateLoss();
Now I find out the answer for my question.
Since I used The following code detail how to transfer from Fragment A to Fragment B
getFragmentManager().beginTransaction()
.replace(R.id.fr_content_activity_fitness, mFm)
.commitAllowingStateLoss();
While Fragment A already added to BackStack
.
So the context now only is Fragment A
.
To detect change orientation in Fragment B
as above question detail, is changed to the following code, it worked :
getFragmentManager().beginTransaction()
.add(R.id.fr_content_activity_fitness, mFm)
.commitAllowingStateLoss();
Used add
instead of replace
.