I have a notes app and basically i want it to save the text input and restore it when i return to the activity. But why isn’t my code doing that? I tried onRestoreInstancestate and onRestore but it’s not working. Any one know how i can save the text input after i exit the app?
notes.java:
public class notes extends Activity{
/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.notes);
Button wg = (Button) findViewById(R.id.button3);
wg.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent intent = new Intent();
setResult(RESULT_OK, intent);
finish();
}
});
}
}
Ok here you have the working, tested code
notes.java (
src\izzy\n\notes.java)notes.xml (
res\layout\notes.xml)What you get
PS: You should maybe start reading some basic Java tutorials since you seem to have problems with basics 🙂