TaskStackBuilder and extras for the back stack

后端 未结 3 1745
失恋的感觉
失恋的感觉 2020-12-13 09:17

I\'m trying to use TaskStackBuilder with notifications to create a back stack for the back button to go through. Normal flow of my app:

  1. Activity A is launched
3条回答
  •  情歌与酒
    2020-12-13 09:51

    I found another way to tackle this problem: use the method TaskStackBuilder.editIntentAt(int)

    ex.

    Intent intentC = new Intent(context, ActivityC.class);
    intentC.putExtra(key, valueC);
    
    TaskStackBuilder sBuilder = TaskStackBuilder.create(this)
        .addParentStack(ActivityB.class)
        .addParentStack(ActivityC.class)
        .addNextIntent(intentC);
    
    Intent intentA = sBuilder.editIntentAt(0);
    intentA.putExtra(key, value);
    Intent intentB = sBuilder.editIntentAt(1);
    intentB.putExtra(key, value);
    

提交回复
热议问题