-
-
Save csaba-farkas/52243c44cca07fa9bdb0cd47c90683f8 to your computer and use it in GitHub Desktop.
Android 'Up' navigation button on screen
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ChildActivity extends AppCompatActivity { | |
@Override | |
public boolean onOptionsItemSelected(MenuItem item) { | |
int id = item.getItemId(); | |
if (id == android.R.id.home) { | |
NavUtils.navigateUpFromSameTask(this); | |
} | |
return super.onOptionsItemSelected(item); | |
} | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_settings); | |
ActionBar actionBar = this.getSupportActionBar(); | |
if (actionBar != null) { | |
actionBar.setDisplayHomeAsUpEnabled(true); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment