Besides that updates don't make much sense when the fragments are not
displayed this fixes the following exception:
java.lang.IllegalStateException: Can not perform this action after
onSaveInstanceState
return view;
}
+ @Override
+ public void onStart()
+ {
+ super.onStart();
+ if (mService != null)
+ {
+ mService.registerListener(this);
+ updateView();
+ }
+ }
+
+ @Override
+ public void onStop()
+ {
+ super.onStop();
+ if (mService != null)
+ {
+ mService.unregisterListener(this);
+ }
+ }
+
@Override
public void onDestroy()
{
super.onDestroy();
if (mService != null)
{
- mService.unregisterListener(this);
getActivity().getApplicationContext().unbindService(mServiceConnection);
}
}
super.onStart();
if (mService != null)
{
+ mService.registerListener(this);
updateView();
}
}
public void onStop()
{
super.onStop();
+ if (mService != null)
+ {
+ mService.unregisterListener(this);
+ }
hideErrorDialog();
hideProgressDialog();
}
super.onDestroy();
if (mService != null)
{
- mService.unregisterListener(this);
getActivity().getApplicationContext().unbindService(mServiceConnection);
}
}