Hi guys,
I'm trying to integrate google search widget, but met a problem when
retrieving keywords from google search widget. It only has problem in the
following scenario:
1. Launch my application, and click back.
2. Enter keyword in google search widget, i..e 'a', and launch it.
Everything works fine.
3. Press Home.
4. Enter keyword in google search widget, i..e 'b', and launch it. But my
application still got 'a' from getIntent() method.
The problem seems to be caused by activity life cycle. For step.4, only
onRestart -> onStart -> onResume -> ... is called so that I can't get the
launching intent from google search widget. The bug goes away if I finish my
application in onStop method. (But it will cause problem for landscape<->
portraint switch since onStop is also invoked when switching screen). Is
there any way to get the query string from google search widget for this
scenario? Or did I miss any setting in AndroidManifest.xml ? Thanks a lot
for your help!
Code to retrieve query string:
Intent intent = getIntent();
String action = intent.getAction();
if (Intent.ACTION_WEB_SEARCH.equals(action) ||
Intent.ACTION_SEARCH.equals(action)) {
String keyword = intent.getStringExtra(SearchManager.QUERY);
}
--
Best Regards,
Joy
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---