appwidgetprovider

How to update App Widget with list view from an Activity

只谈情不闲聊 提交于 2019-12-09 14:29:10
问题 I know this has been asked for many times but I went through the documentation from top to bottom, read all answers here and none of them helped. To be honest, each answer says something different about how to aproach this. Now back to my question. I want to update the widget list view from some activity and I created WidgetProvider#sendUpdateBroadcastToAllWidgets() for this purpose which I call from the activity. It eventually calls the onUpdate() so the broadcast is received correctly. But

Android widget not responding to touches

左心房为你撑大大i 提交于 2019-12-09 07:35:25
I'm trying just some very simple code to get an Android widget going but with no luck. I've looked around everywhere and haven't found a good answer. All I want (for now) is to increment a counter when the widget is touched and display the current value. This is my AppWidgetProvider: public class WordWidget extends AppWidgetProvider { Integer touchCounter = 0; @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { //This is run when a new widget is added or when the update period expires. Log.v("wotd", "Updating " + appWidgetIds.length + "

android widget id only for current widget

社会主义新天地 提交于 2019-12-08 02:15:24
问题 Can I get my current widgetId inside onUpdate() method of AppWidgetProvider ? I found many posts about sending appWidgetId in field of Intent, but I can't understand where I have to get it before sending. I didn't find the methods for getting only current widget Id without configuration activities. 回答1: try in onUpdate int a = appWidgetIds.length; If this returns 1, then: int yourAppWidgetId = appWidgetIds[0]; should return your appWidgetId. EDIT without seeing any code it´s difficult to give

android widget id only for current widget

久未见 提交于 2019-12-06 06:07:30
Can I get my current widgetId inside onUpdate() method of AppWidgetProvider ? I found many posts about sending appWidgetId in field of Intent, but I can't understand where I have to get it before sending. I didn't find the methods for getting only current widget Id without configuration activities. try in onUpdate int a = appWidgetIds.length; If this returns 1, then: int yourAppWidgetId = appWidgetIds[0]; should return your appWidgetId. EDIT without seeing any code it´s difficult to give You the right answer, but I will give You an example. If you created your RemoteViews for your widgets, you

Android appWidgetProvider onEnabled never called on tablet

十年热恋 提交于 2019-12-06 05:55:54
问题 Scenario 1: Device is loaded I add first widget OneX -> Calls onEnabled | Galaxy Tab -> doesnt call onEnabled. Scenario 2: Device is booted with widget already on screen. OneX -> Calls onEnabled | Galaxy Tab -> Calls onEnabled But It must be called when user places one on screen (scenario 1), else whats the point. Surely you dont have to restart your device to get onEnabled called. Its important, because I Attach a alarm manager to update my widget every 2 seconds: AlarmManager alarmManager =

Android onEnabled/onDisabled never called

别等时光非礼了梦想. 提交于 2019-12-04 10:04:22
I'm having a problem with triggering of the onEnabled and onDisabled methods of the AppWidgetReciever. I have the actions specified, I also log every action in onRecieve method, but the only two actions I get are "APPWIDGET_UPDATE" and "APPWIDGET_DELETED". I have googled for this solution, but unfortunately found none. Here is my code: Manifest part: <receiver android:name=".ScheduleWidgetProvider" > <intent-filter> <action android:name="android.appwidget.action.APPWIDGET_ENABLED" /> <action android:name="android.appwidget.action.APPWIDGET_DISABLED" /> <action android:name="android.appwidget

ListView not showing data in App Widget

亡梦爱人 提交于 2019-12-02 05:29:45
问题 I'm trying to implement a simple collection widget for my application, i'm trying to show a ListView inside a widget but the ListView is stuck at Loading... and never finish loading, and i have data in the database and the listview is still stuck with it. Here is the onUpdate method from my AppWidgetProvider class: @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { int length = appWidgetIds.length; for (int x = 0; x < length; x++){

Android widget not updating - has incorrect widget ID

非 Y 不嫁゛ 提交于 2019-12-01 15:33:55
I've been working on a widget and making some advances (I hope) but still can't get it to do what I want. I have a configurator activity which works ok. When it closes I call the updateAppWidget method in the WordWidget class and the widget updates the random number. What I can't do it get the random number to change because of onClick. According to the log I do enter the onReceive() method, but thats about it. In the log I'm printing the widget ID. I noticed that when run from the configurator activity it's printing appWidgetId=33, but when I press the widget it prints appWidgetId=24. This is

Android widget not updating - has incorrect widget ID

陌路散爱 提交于 2019-12-01 15:18:06
问题 I've been working on a widget and making some advances (I hope) but still can't get it to do what I want. I have a configurator activity which works ok. When it closes I call the updateAppWidget method in the WordWidget class and the widget updates the random number. What I can't do it get the random number to change because of onClick. According to the log I do enter the onReceive() method, but thats about it. In the log I'm printing the widget ID. I noticed that when run from the

Android widget stops working after a while?

心不动则不痛 提交于 2019-11-30 19:49:51
I have a flashlight app with a widget. The widget is used to turn the flashlight on and off and does not display main activity or anything. After a few hours, however, the widget does nothing. I mean if you click it, nothing happens. I have two classes to accomplish this a Provider and a Receiver . Provider: public class WidgetProvider extends AppWidgetProvider { @ Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { Intent receiver = new Intent(context, FlashlightWidgetReceiver.class); receiver.setAction("COM_FLASHLIGHT"); receiver.putExtra