开发者

Detecting which Activity is Running at the Moment?

开发者 https://www.devze.com 2023-02-16 04:53 出处:网络
Is there a way to detect which activity is visible at the moment? I have an activity that is launched whenever the server sends an asynchronous message, but if the user hasn\'t answered the previous

Is there a way to detect which activity is visible at the moment?

I have an activity that is launched whenever the server sends an asynchronous message, but if the user hasn't answered the previous message I don't want to take over the screen to display the new message. So I need to know if there is an Activity running of a particular type before launching.

I know I could just store this is inside the application, but I was wondering if there was a native way of doing it.

EDIT: And I do need this... so if you don't know the answer don't say "You will never need this"

EDIT 2: The applicati开发者_C百科on is not for the market, and its for a company that will have it running in the Galaxy Tab by itself

Thanks


You can't do that. I tell you more: you won't ever need it.


Meh. here it is. But what you are doing is just a hack.

This is more likely to be the fix for your use-case. Use the Application class to keep a track of your app's current state.

0

精彩评论

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