com.googlecode.androidannotations.annotations
Annotation Type NonConfigurationInstance


@Retention(value=CLASS)
@Target(value=FIELD)
public @interface NonConfigurationInstance

Use on activity fields to retain instances that are intensive to compute, on configuration changes. See RetainingAnObject in the Android Documentation.

Caution: While you can annotate any field, you should never annotate a field that is tied to the Activity, such as a Drawable, an Adapter, a View or any other object that's associated with a Context. If you do, it will leak all the views and resources of the original activity instance. (Leaking resources means that your application maintains a hold on them and they cannot be garbage-collected, so lots of memory can be lost.)

This caution doesn't apply to beans annotated with Bean, because AndroidAnnotations automatically takes care of rebinding their context.



Copyright © 2010-2013. All Rights Reserved.