0

Here's the thing:

I have a widget and on it are many buttons. Now, I want to keep track if buttons are clicked from widget. In a normal layout:

public void onClick(...){
     // other codes
     Log.d("", "clicked");
}

How about in widget? Thanks.

Thanks.

lorraine batol
  • 6,001
  • 16
  • 55
  • 114
  • 1
    Similar to http://stackoverflow.com/questions/2471875/processing-more-than-one-button-click-at-android-widget – acj Nov 13 '12 at 02:31

1 Answers1

1

You can set the onclickpendingintent like this

views.setImageViewResource(R.id.imagebutton, R.drawable.buttonw);
Intent i = new Intent(context, top.class);
i.putExtra("widget", "1");
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, i, 0);
views.setOnClickPendingIntent(R.id.imagebutton, pendingIntent);

it's an example to set onclick to an imageview that will launch the application when the imageview clicked

if you have any question feel free to ask in the comment

Niko Adrianus Yuwono
  • 11,012
  • 8
  • 42
  • 64
  • i have next,imgeview,prv button when i am click next then next image show in imagview.how to possible – Harshid Feb 25 '13 at 11:30