我有這個筆記應用程序,用戶可以輸入他想要的文本框。但是我也希望即使用戶退出應用程序,文本仍然存在。我如何在notes.java代碼中應用onSavedInstantState和RestoreinstantState?如何將onSavedInstantState應用於此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();
}
});
}
}
嘗試這種情況: [http://stackoverflow.com/questions/6525698/how-to-use-onsavedinstancestate-example-please][1] [1]:HTTP: //stackoverflow.com/questions/6525698/how-to-use-onsavedinstancestate-example-please – Simon 2012-03-02 17:34:14