home-screen-widget

Handling a button click in a home screen widget

落花浮王杯 提交于 2019-12-11 14:15:09
问题 I am trying to make a home screen widget which will toggle on and off the gps (Location in settings). I still don't understand how to handle a button click event. I took this code from a tutorial online. public class LocationWidget extends AppWidgetProvider { private static String SYNC_CLICKED = "automaticWidgetSyncButtonClick"; @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { final int count = appWidgetIds.length; String status;