Why is my searchable activity's Intent.getAction() null?

后端 未结 1 831
走了就别回头了
走了就别回头了 2020-12-15 08:26

I\'ve followed the SearchManager documentation yet am still having trouble making one of my app\'s activities searchable. From my activity, the Search dialog appears, I ente

相关标签:
1条回答
  • 2020-12-15 08:55

    That took too many hours of my life. When performing a search from the searchable singleTop activity (in my case Waypoints) you must override onNewIntent() and grab the search query there. Which after a few hours in, I was doing. The catch was that getIntent() does not return the Intent used to call the activity (head explodes). It seems to return the original Intent that opened my searchable activity before I performed my first search.

    The onNewIntent method receives the search intent. I replaced getIntent() with the param from onNewIntent() and boom, progress.

    Though I must admit; figuring this out eases the frustration of being unable to escape the sound of Dancing with the Stars blaring in the background.

    0 讨论(0)
提交回复
热议问题