It sounds like the ACTION_VIEW might be launched as startActivity() instead of startActivityForResult(), which means the result is being dropped on the path back to Launcher.
The forecast widget example interacts with the system search dialog, and uses singleTop and onNewIntent() to catch searches and still return correctly: http://code.google.com/p/android-sky/source/browse/trunk/Sky/AndroidManifest.xml#57 http://code.google.com/p/android-sky/source/browse/trunk/Sky/src/org/jsharkey/sky/ConfigureActivity.java#287 j On Tue, Oct 27, 2009 at 2:25 AM, Ollie Weng <ollie.w...@gmail.com> wrote: > > Hi, (resend with heading title) > > I'm making a appwidget, and hope to use search UI to let user filter > some infomation while setup widget on receiving APPWIDGET_CONFIGURE. My > current problem is APPWIDGET_CONFIGURE intent depends on setResult() to > decide if adding widget successful. However, using search UI cause > activity reentry to fail to setResult() to original caller. > > Below codes show how and where my code to setResult(), > first when user try to add widget in home screen, we launch the search > UI on APPWIDGET_CONFIGURE intent, and after search UI return result with > Intent.ACTION_VIEW to same activity, it failed to setResult() to tell > caller widget is configured. > But in onUserInteraction() setResult() work, but it's just not correct > timing. Tried extend finish() but still in vain. > > Any suggest is appreciated! > > > public void onCreate(Bundle savedInstanceState) > { > super.onCreate(savedInstanceState); > Intent launchIntent = getIntent(); > > Bundle extras = launchIntent.getExtras(); > > if(Intent.ACTION_VIEW.equals(launchIntent.getAction())) > { > // this is where to handle search result indent, but failed to set > result > > if (appWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID) { > Intent intent = new Intent(); > intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId); > setResult(RESULT_OK, intent); > } > > } else if(Intent.ACTION_SEARCH.equals(launchIntent.getAction())) > { > String query = launchIntent.getStringExtra(SearchManager.QUERY); > > if (appWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID) { > Intent intent = new Intent(); > intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId); > setResult(RESULT_OK, intent); > } > > } else { > // deal android.appwidget.action.APPWIDGET_CONFIGURE here > onSearchRequested(); > } > } > > > TIA, > Ollie > > > > -- Jeff Sharkey jshar...@android.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---