forked from androidannotations/androidannotations
-
Notifications
You must be signed in to change notification settings - Fork 0
Save instance state
pyricau edited this page Aug 2, 2012
·
5 revisions
Since AndroidAnnotations 2.5
You can save the instance state of your activity when it is destroyed by annotating your attributes :
@EActivity
public class MyActivity extends Activity {
@InstanceState
int someId;
@InstanceState
MySerializableBean bean;
}
The attributes values are automatically saved when the system call [onSaveInstanceState(Bundle)](http://developer.android.com/reference/android/app/Activity.html#onSaveInstanceState(android.os.Bundle\)). All of those values are restored when [onCreate(Bundle)](http://developer.android.com/reference/android/app/Activity.html#onCreate(android.os.Bundle\)) is called by the system.
Since AndroidAnnotations 2.7
You can also use @InstanceState
in a fragment annotated with @EFragment
.
AndroidAnnotations was created by Pierre-Yves Ricau and is sponsored by eBusinessInformations.
27/12/2013 The 3.0 release is out !
- Get started!
- Download
- Cookbook, full of recipes
- Customize annotation processing
- List of all available annotations
- Release Notes
- Examples
- Read the FAQ
- Join the Mailing list
- Create an issue
- Tag on Stack Overflow