开发者

Intent filter detection in several Activities

开发者 https://www.devze.com 2023-02-22 07:28 出处:网络
I am developing an NFC application (although I think this doesn\'t really matter for my problem) where I currently have a MainActivity with a TabHost and some other activities (one per tab). I also ha

I am developing an NFC application (although I think this doesn't really matter for my problem) where I currently have a MainActivity with a TabHost and some other activities (one per tab). I also have an Activity that I have done to read NFC tags. This activity contains intent filters in the manifest to catch the tags.

Right now if I scan a tag the last activity runs and launches a dialog. The problem is that it is an independent activity and the background is empty. I would like to launch the dialog in the current activity instead of launching a new one.

How can I do this? My first thought has been to开发者_如何转开发 extend the NFCReader activity in the other Activities but it doesn't work. I think the problem is that in the manifest I have specified the intent-filter only for the NFCReader activity, not for the rest, but I'm not sure.

So the question is: how can I use an intent-filter for all the activities of the application and launch a dialog in front of the current activity without starting a new one?


Move the NFC handling to the activity that has the TabHost, in your case based on description I think it is MainActivity. I got NFC to work correctly on TabHost by that way in my case.

0

精彩评论

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

关注公众号