Skip to content

Commit

Permalink
fix back button
Browse files Browse the repository at this point in the history
  • Loading branch information
brussee committed Aug 7, 2016
1 parent 2d4c3b6 commit 6ce918f
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.LayoutRes;
import android.support.v4.app.NavUtils;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.MenuItem;

import butterknife.BindView;
import butterknife.ButterKnife;
Expand Down Expand Up @@ -67,6 +69,20 @@ public void setContentView(@LayoutRes int layoutResID) {
}
}

/**
* {@inheritDoc}
*/
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Respond to the action bar's Up/Home button
if (android.R.id.home == item.getItemId() && NavUtils.getParentActivityName(this) == null) {
// Redirect SupportActionBar back button to regular back button
onBackPressed();
return true;
}
return super.onOptionsItemSelected(item);
}

/**
* {@inheritDoc}
*/
Expand Down

0 comments on commit 6ce918f

Please sign in to comment.