Próbuję do widgetu wyświetlającego obrazek jeden dodać OnClick i nie wychodzi mi to.
Do OnUpdate próbowałem dać np. takie coś:
Intent intent = new Intent(context, mojMain.class);
intent.setAction(ACTION_KLIKNIECIE);
PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, intent, 0);
RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.layout);
remoteViews.setOnClickPendingIntent(R.id.imageView1, pendingIntent);
- metoda
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.layout);
ComponentName componentName = new ComponentName(context, mojMain.class);
AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
appWidgetManager.updateAppWidget(componentName, views);
a w OnReceive dałem:
if (intent.getAction().equals(ACTION_KLIKNIECIE))
{
//i coś tam
}
do manifestu też dodałem "<action android:n..."
coś, pod <intent-filter>
I nie chce działać ten cały kod. Klikam w Image i nic. Wiecie co mogę robić źle, czego brakuje? Bardzo proszę o pomoc.
dodanie znaczników <code class="java"> i `` - furious programming