I use toolbar in activity like this:
Toolbar myToolbar = (Toolbar) findViewById(R.id.my_toolbar);
setSupportActionBar(myToolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
And this code in AppCombatActivity:
@Override
public boolean onSupportNavigateUp() {
onBackPressed();
return true;
}
In Manifest I defined parent activity.
It works. But everytime I press the button 'onCreate' is called on parent activity. But thats not what I want. Whenn I press the back-button on the device it goes back to previous activity and just calls onResume. That is what it also should do when I press the back button in the toolbar.
Any Ideas? Thanks!