Back to project page OpenGate.
The source code is released under:
Apache License
If you think the Android project OpenGate listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.arquitetaweb.opengate; //www. ja va 2s . com import android.app.PendingIntent; import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetProvider; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.widget.RemoteViews; public class OpenGateProvider extends AppWidgetProvider { @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget_opengate); remoteViews.setOnClickPendingIntent(R.id.widget_image, buildButtonPendingIntent(context)); pushWidgetUpdate(context, remoteViews); } public static PendingIntent buildButtonPendingIntent(Context context) { Intent intent = new Intent(); intent.setAction("com.arquitetaweb.intent.action.CHANGE_PICTURE"); return PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); } public static void pushWidgetUpdate(Context context, RemoteViews remoteViews) { ComponentName myWidget = new ComponentName(context, OpenGateProvider.class); AppWidgetManager manager = AppWidgetManager.getInstance(context); manager.updateAppWidget(myWidget, remoteViews); } }