save the state when back button is pressed
I am developing an android app. If I press a back button the state of my application should be saved .What should i use to save the state ..am confused with all of these onPause() , onResume() , or onRestoresavedInstance() ??? which of these should i use to save the state of my application?? For eg when i press exit button my entire app should exit i have used finish() ? public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); s1=(Button)findViewById(R.id.sn1); s1.setOnClickListener(this); LoadPreferences(); s1.setEnabled(false); }