downloadon Intent intent = new Intent("com.paad.ACTION_WIDGET_CLICK");
Wrax.com PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, intent, 0); views.setOnClickPendingIntent(R.id.my_text_view, pendingIntent);
Using this technique you can add click handlers to one or more of the Views used within your widget, which means you can add support for multiple actions.
For example, the standard media player widget assigns different broadcast Intents to several buttons, providing playback control through the play, pause, and next buttons.
Image Views are one of the most flexible types of View available for your widget UI, providing support for some basic user interactivity within your widgets.
Using a SelectionStateDrawable resource (described in Chapter 3) you can create a Drawable resource that displays a different image based on the selection state of the View it is assigned to. By using a Selection State Drawable in your widget design, you can create a dynamic UI that highlights the user selection as he or she navigates though the widget's controls.
The XML snippet in Listing 10-11 shows a sample Selection State Drawable resource.
Was this article helpful?
Quick start guide to skyrocket your offline and online business success with mobile apps. If you know anything about mobile devices, you’ve probably heard that famous phrase coined by one of the mobile device’s most prolific creators proclaiming that there’s an app for pretty much everything.