cursor adapter looses data when application minimized
I am using a cursor adapter to retrieve the data from the database and binding it to the spinner control. It's working fine but the problem occurs when user sending the application in the background after that all the spinner co开发者_如何转开发ntrol looses the data.
Help me, Waiting for your valuable answers.
ya it will happen, for that you have to save object Instance using below methods 0f Activity
@Override
protected void onRestoreInstanceState(Bundle savedState) {
super.onRestoreInstanceState(savedState);
// retrieve stored data
savedState.get[...]
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
// and place it
outState.put[...]
}
精彩评论