I am populating a ListView with the contents of an SQLite database. In my onCreate
method in my StartList
activity I call an AsyncSQLite
which reads data from a JSON url and adds the data to the SQlite database.
But every time that I change my screen orientation, my app is calling the AsyncSQLite
method again. I have added android:configChanges="orientation|keyboardHidden|screenSize"
to my AndroidManifest.xml
but that doesn't seem to be making a difference.
Here is my onCreate
method from my StartList
activity:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_start_List);
oslist.clear();
oslist = new ArrayList<LinkedHashMap<String, String>>();
new AsyncSQLite().execute();
}
Here is my AndroidManifest.xml
:
<activity
android:name=".StartList"
android:label="@string/title_activity_start_List"
android:parentActivityName=".MainActivity"
android:configChanges="orientation|keyboardHidden|screenSize">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity" />
</activity>
I thought that onCreate
should only be called once when the activity is being created, but instead it is being called whenever I change the orientation.
Aucun commentaire:
Enregistrer un commentaire