Android: How do I avoid starting activity which is already in stack?

前端 未结 7 2162
一整个雨季
一整个雨季 2020-12-23 12:20

Lets try to explain my question: I got an application and a service. The application is started with activity A. The service sends a broadcast that will let the application

7条回答
  •  感情败类
    2020-12-23 13:00

    I think you need to make your activity B singleInstance that if it's already create you don't want to create again, that is launch mode of the activity can be defined in manifest android:launchMode that defines how the activity will be instanciated.

    in your case use android:launchMode="singleInstance"

提交回复
热议问题