call super.onSaveInstanceState() last

Move call to end of derived class' method. This may very well be the
solution to a bunch of random crashes logging
"java.lang.IllegalStateException: Can not perform this action after
onSaveInstanceState". Chief suspect is the change in XWActivity.java,
but I'm making it everywhere for consistency's sake: it's a good habit
to get into.
This commit is contained in:
Eric House 2017-03-15 19:38:57 -07:00
parent df8ebaec06
commit 19bfcfc3a2
8 changed files with 11 additions and 8 deletions

View file

@ -67,9 +67,9 @@ public class DBAlert extends XWDialogFragment {
@Override
public void onSaveInstanceState( Bundle bundle )
{
super.onSaveInstanceState( bundle );
bundle.putInt( DLG_ID_KEY, mDlgID.ordinal() );
bundle.putSerializable( PARMS_KEY, mParams );
super.onSaveInstanceState( bundle );
}
@Override

View file

@ -65,8 +65,8 @@ abstract class DlgDelegateAlert extends XWDialogFragment {
@Override
public void onSaveInstanceState( Bundle bundle )
{
super.onSaveInstanceState( bundle );
bundle.putParcelable( STATE_KEY, m_state );
super.onSaveInstanceState( bundle );
}
@Override

View file

@ -1041,7 +1041,6 @@ public class GamesListDelegate extends ListDelegateBase
@Override
protected void onSaveInstanceState( Bundle outState )
{
// super.onSaveInstanceState( outState );
outState.putBoolean( SAVE_NEXTSOLO, m_nextIsSolo );
outState.putSerializable( SAVE_SELGAMES, (HashSet)m_selGames );
outState.putSerializable( SAVE_SELGROUPS, (HashSet)m_selGroupIDs );
@ -1051,6 +1050,7 @@ public class GamesListDelegate extends ListDelegateBase
if ( null != m_rematchExtras ) {
outState.putBundle( SAVE_REMATCHEXTRAS, m_rematchExtras );
}
super.onSaveInstanceState( outState );
}
private void getBundledData( Bundle bundle )

View file

@ -46,8 +46,8 @@ public class LookupAlert extends XWDialogFragment {
@Override
public void onSaveInstanceState( Bundle bundle )
{
super.onSaveInstanceState( bundle );
m_view.saveInstanceState( bundle );
super.onSaveInstanceState( bundle );
}
@Override

View file

@ -88,8 +88,8 @@ public class MainActivity extends XWActivity
@Override
protected void onSaveInstanceState( Bundle outState )
{
super.onSaveInstanceState( outState );
m_safeToCommit = false;
super.onSaveInstanceState( outState );
}
@Override

View file

@ -88,10 +88,10 @@ public class TilePickAlert extends XWDialogFragment
@Override
public void onSaveInstanceState( Bundle bundle )
{
super.onSaveInstanceState( bundle );
bundle.putSerializable( TPS, m_state );
bundle.putSerializable( ACTION, m_action );
m_view.saveInstanceState( bundle );
super.onSaveInstanceState( bundle );
}
@Override

View file

@ -66,8 +66,11 @@ public class XWActivity extends FragmentActivity
@Override
protected void onSaveInstanceState( Bundle outState )
{
super.onSaveInstanceState( outState );
if ( XWApp.LOG_LIFECYLE ) {
DbgUtils.logi( TAG, "onSaveInstanceState(this=%H)", this );
}
m_dlgt.onSaveInstanceState( outState );
super.onSaveInstanceState( outState );
}
@Override

View file

@ -85,10 +85,10 @@ abstract class XWFragment extends Fragment implements Delegator {
public void onSaveInstanceState( Bundle outState )
{
DbgUtils.logd( TAG, "%s.onCreate() called", getClass().getSimpleName() );
super.onSaveInstanceState( outState );
Assert.assertNotNull( m_parentName );
outState.putString( PARENT_NAME, m_parentName );
m_dlgt.onSaveInstanceState( outState );
super.onSaveInstanceState( outState );
}
protected void onCreate( DelegateBase dlgt, Bundle sis )