onSaveInstanceState is apparently called after pausing the fragment and after
that committing any FragmentTransactions causes an IllegalStateException.
We could use commitAllowingStateLoss() but that's not really necessary
as we don't need to update when we are not active anyway. We also don't
update the view directly after registration as this happens
asynchronously, i.e. we might be paused when it finishes.
{
mService = ((VpnStateService.LocalBinder)service).getService();
mService.registerListener(ImcStateFragment.this);
- updateView();
}
};
}
@Override
- public void onStart()
+ public void onResume()
{
- super.onStart();
+ super.onResume();
if (mService != null)
{
mService.registerListener(this);
}
@Override
- public void onStop()
+ public void onPause()
{
- super.onStop();
+ super.onPause();
if (mService != null)
{
mService.unregisterListener(this);