I tried this code to show my ProfileActivity
:
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.action_profile) {
Intent mainIntent = new Intent(Contracts.this, Profile.class);
startActivity(mainIntent);
return true;
}
return super.onOptionsItemSelected(item);
}
When I click on Profile menu Item I can see my ProfileActivity
but I not have any back button on my ActionBar
to return in my previous activity.
So, how can I show some back button? Is correct my code to display an activity from my menu?