When I press the ActionBar Back button (<) in the upper left corner of ActionBarActivity, I would like to instruct you to return to the previous screen. How should I rewrite it?
Thank you for your cooperation.
@Override
public boolean onOptionsItemSelected(MenuItem){
switch(item.getItemId()){
case R.id.home:
finish();
}
return super.onOptionsItemSelected(item);
}
If you change R.id.home
to android.R.id.home
, it will work.
© 2024 OneMinuteCode. All rights reserved.