Add on(Save|Restore)InstanceState in Android extensions
This commit is contained in:
@@ -143,6 +143,23 @@ public class Extension {
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called to retrieve per-instance state from an activity before being
|
||||||
|
* killed so that the state can be restored in onCreate
|
||||||
|
*/
|
||||||
|
public void onSaveInstanceState (Bundle outState) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called after onStart() when the activity is being re-initialized from
|
||||||
|
* a previously saved state.
|
||||||
|
*/
|
||||||
|
public void onRestoreInstanceState (Bundle savedState) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|||||||
@@ -496,6 +496,21 @@ public class GameActivity extends Activity implements SensorEventListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override protected void onSaveInstanceState (Bundle outState) {
|
||||||
|
super.onSaveInstanceState(outState);
|
||||||
|
for (Extension extension : extensions) {
|
||||||
|
extension.onSaveInstanceState (outState);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override protected void onRestoreInstanceState (Bundle savedState) {
|
||||||
|
super.onRestoreInstanceState(savedState);
|
||||||
|
for (Extension extension : extensions) {
|
||||||
|
extension.onRestoreInstanceState (savedState);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override public void onSensorChanged (SensorEvent event) {
|
@Override public void onSensorChanged (SensorEvent event) {
|
||||||
|
|||||||
Reference in New Issue
Block a user