Code example for FragmentActivity

Methods: getLastNonConfigurationInstance, getTaskId, onRestoreInstanceState

0
//		return new Integer(getTaskId()); 
//	} 
 
	@Override 
	protected void onRestoreInstanceState(Bundle savedState) {
		super.onRestoreInstanceState(savedState);
		// Restore state; we know savedState is not null 
		String answer = null != savedState ? savedState.getString("answer") : "";
		// This is a gratuitious test, remove it 
		Object oldTaskObject = getLastNonConfigurationInstance();
		if (null != oldTaskObject) {
			int oldtask = ((Integer) oldTaskObject).intValue();
			int currentTask = getTaskId();
			// Task should not change across a configuration change 
			assert oldtask == currentTask;
		} 
		Log.i(TAG, "onRestoreInstanceState"
				+ (null == savedState ? "" : RESTORE) + " " + answer);
	} 
 
	// ////////////////////////////////////////////////////////////////////////////