1

The following code creates a widget and adds it to my layout. But no matter what listener 'OnLongClick' or 'OnFocus' ... I add to 'hostView' no one does trigger. Also 'hostView' ignores 'setFocusable(false)'. Has anyone an idea how to add listeners to Widget's from hostviews?

public void createWidget(Intent data) {
    Bundle extras = data.getExtras();
    int appWidgetId = extras
            .getInt(AppWidgetManager.EXTRA_APPWIDGET_ID, -1);
    AppWidgetProviderInfo appWidgetInfo = mAppWidgetManager
            .getAppWidgetInfo(appWidgetId);
    final AppWidgetHostView hostView = mAppWidgetHost.createView(this,
            appWidgetId, appWidgetInfo);
    hostView.setAppWidget(appWidgetId, appWidgetInfo);
    ((LinearLayout) findViewById(R.id.widgetHolder)).addView(hostView);
    ((ImageButton) findViewById(R.id.bApps)).requestFocus();
}
paulgavrikov
  • 1,883
  • 3
  • 29
  • 51

0 Answers0