ActionBar up navigation recreates parent activity instead of onResume

前端 未结 6 2032
天涯浪人
天涯浪人 2020-12-04 16:26

I\'m using the recommended approach for Up Navigation and my code looks like this:

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switc         


        
6条回答
  •  生来不讨喜
    2020-12-04 16:50

    you just need to go back , not to create the activity again.

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case android.R.id.home:
                super.onBackPressed();
                return true;
        }
        return super.onOptionsItemSelected(item);
    }
    

提交回复
热议问题