Code example for Intent

Methods: getBroadcastaddCategorysetClasssetData

0
     * @param context 
     * @param appWidgetId 
     * @return 
     */ 
    private static PendingIntent getLaunchPendingIntent(Context context, int appWidgetId, int buttonId) {
        Intent launchIntent = new Intent();
        launchIntent.setClass(context, SettingsAppWidgetProvider.class);
        launchIntent.addCategory(Intent.CATEGORY_ALTERNATIVE);
        launchIntent.setData(Uri.parse("custom:" + buttonId));
        PendingIntent pi = PendingIntent.getBroadcast(context, 0 /* no requestCode */,
                launchIntent, 0 /* no flags */);
        return pi;
    } 
 
    /** 
     * Receives and processes a button pressed intent or state change. 
     * 
     * @param context 
     * @param intent  Indicates the pressed button. 
     */ 
    @Override