Search code examples
androidnavigation-drawer

How do I integrate google's search interface with the navigation component pattern?


The navigation component pattern uses a single activity and multiple fragments, but the search interface provided by google sends the search results to a searchable activity, and this disrupts the flow of the navigation component.

How do I send the results of search interface to a fragment instead of to an activity? I have searched google but can't find anything helpful. I appreciate your help.


Solution

  • I think you might be reading too much into it, there are many dependencies which use another activity as a mechanism to get back results to you. Google Places is another one of them.

    I think what they mean by the use of single activity and multiple fragments is for your project you should have one single activity and do all the work with the help of multiple fragments.

    Coming to searchable activity it is not as if you have a whole another activity in your project where half your business logic resides. You are just using it as a mechanism to offload something to a dependency while you still will be receiving the results of it in your Fragment only.