Add on(Save|Restore)InstanceState in Android extensions
This commit is contained in:
@@ -145,4 +145,21 @@ 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) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -498,6 +498,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) {
|
||||
|
||||
loadNewSensorData (event);
|
||||
|
||||
Reference in New Issue
Block a user