Java tutorial
//package com.java2s; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.widget.RemoteViews; public class Main { public static void setClickPendingIntent(RemoteViews remoteButton, Intent intent, Context context, int buttonId) { PendingIntent clickPI = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); remoteButton.setOnClickPendingIntent(buttonId, clickPI); } }