build a search widget을 원합니다. 위젯을 클릭하면 내 앱 내에서 검색 활동이 열립니다. 다음은 위젯 공급자의 onUpdate() 코드입니다. 내 SearchActivity.onCreate 내부위젯 공급자가 의도 한 작업을 게시합니다.
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds)
{
/* as their may be many widget instances for this widget. we get an array. */
for(int i=0;i< appWidgetIds.length; i++)
{
Intent intent = new Intent(context, SearchActivity.class);
intent.setAction("android.intent.action.SEARCH");
PendingIntent pdIntent = PendingIntent.getActivity(context, 0, intent, 0);
RemoteViews view = new RemoteViews(context.getPackageName(), myPackage.R.layout.search_appwidget);
view.setOnClickPendingIntent(R.id.search_widget_textbox,pdIntent);
appWidgetManager.updateAppWidget(appWidgetIds[i], view);
}
}
는(), 내가 Intent.ACTION_SEARCH.equals(this.getIntent().getAction())
같은 의도 행동을 확인하고 있습니다. 그러나 위젯 제공자를 통해 PendingIntent를 사용하여 인 텐트를 게시하면 this.getIntent().getAction()
은 null을 반환합니다. SearchActivity (앱의 기본 SearchManager 처리기)가 SearchManager를 통해 호출되면 android.intent.action.SEARCH
과 같은 유효한 동작을 가져옵니다.
계류중인 의도는 무엇입니까?