Setting up Alarm Manager is creating 2 Instances of my Main Activity

前端 未结 3 2074
闹比i
闹比i 2020-12-06 23:51

I have 2 activities, a Main Activity and SetAlarm Activity. I call SetAlarm Activity from Main. When I set up the alarm I create an instance of my main. How do I set up the

3条回答
  •  伪装坚强ぢ
    2020-12-07 00:23

    if you want that your startActivity should not start multiple instances of alam activity you should go to your manifest and have to add an attribute named launchMode for your alarm activity and set it to SingleTop that will ensure that only one instance remains in the taskk back stack(plac where every activity resides in LIFO manner)

提交回复
热议问题