This repository has been archived by the owner on Feb 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Save instance state
Kay-Uwe Janssen edited this page Mar 11, 2017
·
8 revisions
You can only use @InstanceState
on types that can be stored in a Bundle. Such as primitives or types that implement Serializable or Parcelable or an annotated Parceler bean.
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). All of those values are restored when onCreate(Bundle) is called by the system.
Since AndroidAnnotations 2.7
You can also use @InstanceState
in a fragment annotated with @EFragment
.
Since AndroidAnnotations 4.2
You can also use @InstanceState
in a view annotated with @EView
or @EViewGroup
.
19/11/2020 The 4.8.0 release is out !
- Get started!
- 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
- Ask on Gitter