James Wierzba
James Wierzba

Reputation: 17568

Returning from activity B->A via Android HOME button does not restore intent

I have activity A that gets passed a long ID value via long extra, when the activity is initially launched. When I go from A-B, and then press home, the ID value is gone. How can I restore it?

When going from A->B

Intent intent = new Intent(A.this, B.class);
startActivity(intent);

I've tried:

Upvotes: 0

Views: 131

Answers (1)

Jolson Da Costa
Jolson Da Costa

Reputation: 1105

what is onFinish in your code?

try this code in your B Activity to get it finish when you press up button in actionbar

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    // Respond to the action bar's Up/Home button
    case android.R.id.home:
        finish();
        return true;
    }
    return super.onOptionsItemSelected(item);
}

Upvotes: 3

Related Questions