title: android widget listview clickable
body: <p>I have a widget which has a listview. I am trying to bind event to the listitem inside the listview. I have been through several code examples none of them works! </p>
  
  <p>// widget provider</p>
  
  <pre><code>public class Widget extends AppWidgetProvider
  {   
  
      public static String YOUR_AWESOME_ACTION = "com.my.assignmentmanager.YourAwesomeAction";
  
      @Override
      public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds)
      {
          for (int i = 0; i &lt; appWidgetIds.length; i++)
          {
              Intent svcIntent = new Intent(context, WidgetService.class);
  
              svcIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetIds[i]);
              svcIntent.setData(Uri.parse(svcIntent.toUri(Intent.URI_INTENT_SCHEME)));
  
              RemoteViews widget = new RemoteViews(context.getPackageName(), R.layout.widget_layout);
  
              widget.setRemoteAdapter(appWidgetIds[i], R.id.widgetListView, svcIntent);
  
  
  
  
              Intent toastIntent = new Intent(context, Widget.class);
              // Set the action for the intent.
              // When the user touches a particular view, it will have the effect of
              // broadcasting TOAST_ACTION.
              toastIntent.setAction(Widget.YOUR_AWESOME_ACTION);;
              toastIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetIds[i]);
  
  
              svcIntent.setData(Uri.parse(svcIntent.toUri(Intent.URI_INTENT_SCHEME)));
  
              PendingIntent toastPendingIntent = PendingIntent.getBroadcast(context, 0, toastIntent,PendingIntent.FLAG_UPDATE_CURRENT);              
  
              widget.setPendingIntentTemplate(R.id.widgetListView, toastPendingIntent);
  
  
  
              appWidgetManager.updateAppWidget(appWidgetIds[i], widget);
          }
  
          super.onUpdate(context, appWidgetManager, appWidgetIds);
      }
  </code></pre>
  
  <p>The on receive method! should be able to throw log </p>
  
  <pre><code>    @Override
      public void onReceive(Context context, Intent intent)
      {
          Log.d("debug", "onReceive");
          super.onReceive(context, intent);
  
          Log.d("debug", "onReceive");
  
      }       
  
  }
  </code></pre>
  
  <p>The widget layout xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
  
      &lt;ListView
          android:id="@+id/widgetListView"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_weight="1" &gt;
      &lt;/ListView&gt;
  
      &lt;TextView
          android:id="@+id/empty_view"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:gravity="center"
          android:text="wqeqweqwew"
          android:textColor="#ffffff"
          android:textSize="20sp"
          android:visibility="gone" /&gt;
  
  &lt;/FrameLayout&gt;
  </code></pre>
  
  <p>The getViewAt method of Widget factory</p>
  
  <pre><code>          @Override
  public RemoteViews getViewAt(int rowNumber)
  {
  
      RemoteViews remoteView = new RemoteViews(mContext.getPackageName(), R.layout.widget_listitem);
      remoteView.setTextViewText(R.id.widgetAssignmentTitle, mWidgetItems.get(0).assignmentTitle);
      remoteView.setTextViewText(R.id.widgetDaysLeft, mWidgetItems.get(0).assignmentTitle);
  
      Log.d("debug", "wwwwwwwwwwwwwwwwww");
      Bundle extras = new Bundle();
      extras.putInt("KEY", rowNumber);
      Intent fillIntent = new Intent();
      fillIntent.putExtra("Water", rowNumber);
  
      remoteView.setOnClickFillInIntent(R.layout.widget_listitem, fillIntent);
  
      return (remoteView);
  }
  </code></pre>
  
  <p>I dont know but binding just a click is such a headache on android! I am able to bind data but cannot bind a click event. </p>