I am having trouble restoring the state of one of my activities. I am starting activity B from within activity A with
mListView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, final int position, long id) {
// Display dialog
AlertDialog.Builder builder = new AlertDialog.Builder(TransactionActivity.this);
builder.setTitle(null)
.setItems(R.array.tran_options_array, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// The 'which' argument contains the index position
// of the selected item
switch (which) {
case 0:
//
// View
//
// Load transaction detail activity
Intent intent = new Intent(getApplicationContext(),
TransactionDetailActivity.class);
Bundle bundle = new Bundle();
Tran transaction = mTransactionList.get(position);
bundle.putSerializable("transaction_key", mTransactionList.get(position));
intent.putExtras(bundle);
startActivity(intent);
break;...
@Override
protected void onSaveInstanceState(Bundle outState) {
outState.putString("type", mType);
super.onSaveInstanceState(outState);
}
After startActivity(intent) onPause() is called and then onSaveInstanceState(). Clicking on the back button on activity B then results in onDestroy() being called in Activity A and then onCreate() with the (Bundle savedInstanceState) as null.