开发者

How to make a click on an item in the global search provider (Quick Search Box) go to the correct Activity

开发者 https://www.devze.com 2023-03-22 10:31 出处:网络
I have an application that has the structure: Activity A Activity B Activity C In activity B I call startActivityForResult on Activity C.

I have an application that has the structure:

  • Activity A

    • Activity B

      • Activity C

In activity B I call startActivityForResult on Activity C.

In Activity C I have a search 开发者_开发百科provider where the user can search addresses and then return them to activity B.

This works great, but when I introduce the search results in the Quick Search Box (Reference Link) then a click on the suggestion will go straight to Activity C. Calling finish on that activity will then not do what I want (returning to B with the result).

So any suggestions on how to rewrite this to work in both scenarios?


You need to pass the result between activities

Activity C --> send the result to ---> Activity B.

how to use onActivityResult(..) if the activity is called from a menu

See my answer here. Its the same, mind the comments below.


Set android:launchMode="singleTop" for Activity C in manifest.

0

精彩评论

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