@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); MenuInflater inflater = getMenuInflater(); inflater.inflate(menuId, menu); return true; }
// Implement save/restore protected void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); String st = savedInstanceState.getString("debugViewText"); if (st == null) return; TextView tv = getTextView(); tv.setText(st); Log.d(tag, "Restored state"); }
@Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); if (this.m_retainState == false) return; // save state TextView tv = getTextView(); String t = tv.getText().toString(); outState.putString("debugViewText", t); Log.d(tag, "Saved state"); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.debug_activity_layout); }