Using actionbar home as up button, home activity saveInstanceState is always null

In the onCreate() enable the home button.

@Override
public void onCreate(Bundle savedInstanceState) {
    ...
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setDisplayShowHomeEnabled(true);
}

In the onOptionItemSelected() method do this.

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

This should enable Up navigation. If you want the parent activity to be restored with a savedInstanceState. You should set launchMode="singleTop" in the parent activity in Manifest file.

For more info check out http://developer.android.com/: Providing Up Navigation

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)