NavUtils.navigateUpTo() does not start any Activity

前端 未结 9 2125
陌清茗
陌清茗 2021-01-30 06:48

I have two activities

  • MainActivity
  • DeepLinkActivity

I set up everything to use the NavUtils for navi

9条回答
  •  一向
    一向 (楼主)
    2021-01-30 07:25

    It doesn't work for me too. So I handle up this way:

       @Override
        public boolean onOptionsItemSelected(MenuItem item) {
            if (item.getItemId() == android.R.id.home) {
    
                    Intent intent = new Intent(this, MainActivity.class);
                    startActivity(intent);
                    finish();
                    return true;
    
            }
            return super.onOptionsItemSelected(item);
        }
    

    My MainActivity is marked as singleTask in android manifest

    android:launchMode="singleTask"
    

提交回复
热议问题