Reputation: 3
I want to retain the instance of an object on configuration changes using Fragments. And I want to support older versions of android using support library. So I extended FragmentActivity like this.
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
public class test extends FragmentActivity {
@Override
public void onCreate(Bundle state){
super.onCreate(state);
setRetainInstance(true);
}
}
But when I do this, Eclips complains that there is no such a thing as setRetainInstance. But when I change the FragmentActivity to Fragment every thing is OK. what am I missing?
Upvotes: 0
Views: 82
Reputation: 11131
setRetainInstance(Boolean)
is a method in Fragment
class. not of FragmentActivity
class...
and There is a support library for Fragment
s in Android SDK.
see at android-sdk/extras/android/support/v4/android-support-v4.jar
Upvotes: 2