开发者

how to finish multiple instances of an activity at once in android

开发者 https://www.devze.com 2023-03-11 08:33 出处:网络
The activities in stack are A,B1,B2,B3,B4. if i press back button in B4(activity) i should finish all the instances of B activity and it shoul开发者_如何转开发d take me tothe A activity.

The activities in stack are A,B1,B2,B3,B4. if i press back button in B4(activity) i should finish all the instances of B activity and it shoul开发者_如何转开发d take me to the A activity.


On B4 you should call the below method:

@Override
public void onBackPressed() {
 startActivity(new Intent(this, A.class)
 .setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP));
 return;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消