I have an action bar that looks like so:
I am using the following to see which button is clicked:
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
switch (item.getItemId())
{
case R.id.view_all_trains:
Intent i = new Intent(ToStationActivity.this, MapActivity.class);
startActivityForResult(i, 0);
case android.R.id.home:
NavUtils.navigateUpFromSameTask(this);
}
return true;
}
No matter what button you press, (the back or the pin), it goes back to the previous screen and I am not sure why. Any suggestions as to why this may happen?
Put a break
statement at the end of each case of the switch!