laaptu/appwidget-listview — pull request #2 by pitambar (2013-12-09 08:38:30+00:00)
Title: Appwidget listview2

hi i am using this list view,
is it possible to add 1 button on widget, on click of it ,it should open my app, i tried the below code for it, when i use this code ,list view displays empty view, & it forc close some time, how to do that ,please

public class WidgetProvider extends AppWidgetProvider {

/*
* this method is called every 30 mins as specified on widgetinfo.xml this
* method is also called on every phone reboot
*/
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager,
int[] appWidgetIds) {
final int N = appWidgetIds.length;
/*
* int[] appWidgetIds holds ids of multiple instance of your widget
* meaning you are placing more than one widgets on your homescreen
*/
// initializing widget layout

RemoteViews viewClick = new
RemoteViews(context.getPackageName(),R.layout.widget_layout);

Intent informationIntent = new Intent(context,info.class);
PendingIntent infoPendingIntent = PendingIntent.getActivity(context,0, informationIntent, 0);
viewClick.setOnClickPendingIntent(R.id.btnSeeMore,infoPendingIntent);

for (int i = 0; i < N; ++i) {
RemoteViews remoteViews = updateWidgetListView(context,
appWidgetIds[i]);
appWidgetManager.updateAppWidget(appWidgetIds[i], remoteViews);
// register for button event

}

super.onUpdate(context, appWidgetManager, appWidgetIds);
}

xml contain a button btnseemore