Back to project page Swipelight_Flashlight.
The source code is released under:
Apache License
If you think the Android project Swipelight_Flashlight 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.collinguarino.flashlight; /*from ww w . ja v a 2 s . co m*/ import android.app.PendingIntent; import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetProvider; import android.content.Context; import android.content.Intent; import android.widget.RemoteViews; public class LockScreenWidgetProvider extends AppWidgetProvider { @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { super.onUpdate(context, appWidgetManager, appWidgetIds); /*Intent receiver = new Intent(context, LockFlashlightWidgetReceiver.class); receiver.setAction("COM_FLASHLIGHT"); receiver.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, appWidgetIds); PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, receiver, 0); RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.lockscreen_widget_layout); views.setOnClickPendingIntent(R.id.imageView, pendingIntent); appWidgetManager.updateAppWidget(appWidgetIds, views);*/ Intent intent = new Intent(context, Main.class); PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0); RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.lockscreen_widget_layout); views.setOnClickPendingIntent(R.id.widgetView, pendingIntent); appWidgetManager.updateAppWidget(appWidgetIds, views); } }