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

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to