Questions tagged [android-appwidget]

Android App Widgets are custom views that can be placed on the home screen of an Android device.

Android App Widgets are custom views that can be placed on the homescreen of an Android device.

Useful links

947 questions
38
votes
3 answers

Android Widget Not Updating

I am trying to implement a simple widget for display on the home screen. The problem I am experiencing is that onUpdate is only being called once when I install the widget. The configuration is below. Note: I will not leave update period at 20 secs…
phogel
  • 2,005
  • 3
  • 16
  • 12
37
votes
4 answers

Widget for turning on/off camera flashlight in android

I am developing a widget for turning on/off camera led of phone. I have made a widget that can work like toggle button (on/off). Behavior is like follows : Sometimes the led light remains on when i enable the widget. But it doesnot turn on/off the…
33
votes
4 answers

Android - how update widget often but only when it is visible?

I'm going to create widget which needs to update its content every minute (it shows time-related data). However, there is no need to update widget if it is currently invisible, which means: screen is turned off another app is running widget is…
tomash
  • 12,372
  • 15
  • 61
  • 80
33
votes
1 answer

Widget onUpdate called when Configuration Activity is launched

I'm implementing a widget and I'm facing the following problems: 1) onUpdate is called when I add the widget to the home screen, even if I specified a Configuration Activity. As soon as I add it to the home screen, the APPWIDGET_ENABLED broadcast is…
23
votes
7 answers

Detect rotation of Android home screen

I have an App Widget which, when it updates, fetches an image having dimensions to match the widget, and places that image into an ImageView (via RemoteViews). It works just fine. But for devices that support rotation of the home screen (and I'm…
drmrbrewer
  • 8,355
  • 11
  • 60
  • 138
22
votes
2 answers

Widget Preview save location

I've taken a screenshot of my app widgets in the Honeycomb emulator using the default "Widget Preview" application, but I don't know in which location the image has been saved. I've been looking around using adb shell commands as well as looking in…
Kaloer
  • 3,763
  • 2
  • 25
  • 33
21
votes
2 answers

How do I give a Android App Widget a Label/Name

I just finished my first app, it works fine and I've made it a homescreen widget. But it doesn't have the name under it. The tutorial I am following says nothing about it, shouldn't this just be the name of the app and be pulled in automatically?
kavrecon
  • 211
  • 1
  • 2
  • 3
20
votes
1 answer

Android: Is there a way to get the size of a RemoteViews object?

In my app widget, I have a LinearLayout whose height and width are set to fill_parent. Is there a way to get at runtime, the actual size that has been allocated to this view?
Tom
  • 241
  • 2
  • 6
20
votes
1 answer

How to disable Widget updatePeriodMillis?

I'm trying to figure out how I can disable the update period on my widgets? I don't need this particular feature. I'm just fine with the widget calling onUpdate when added that's it...
Jona
  • 12,642
  • 13
  • 82
  • 124
20
votes
4 answers

How to create an app widget with a configuration activity, and update it for the first time?

This is driving me crazy. I don't know how to update the app widget from the configuration activity, even with the recommended practises. Why the update method is not called on the app widget creation is beyond my understanding. What I'd like: an…
Benoit Duffez
  • 9,889
  • 11
  • 69
  • 114
19
votes
3 answers

Service not starting on Oreo in app widget using PendingIntent

I'm using Android app widgets. I'm creating a PendingIntent object and use it in the method RemoteViews#setOnClickPendingIntent(). This is the pending intent: // The below code is called in the onUpdate(Context, AppWidgetManager, int[]) method of…
18
votes
1 answer

How to influence linebreak in Android Textview

I have an Appwidget displaying days until an event like: eventname (-231 days) If possible I want to display this String in one line. If the eventname is too long I want to display the full term in braces into a new line. So that it is…
Tobias
  • 6,533
  • 5
  • 59
  • 82
18
votes
3 answers

Android: loading WebView output into App Widget

Whilst I appreciate that an App Widget does not support a WebView directly, is it at all possible to use an ImageView (which is supported), and a technique like described here to generate the image for the ImageView? The WebView wouldn't be used…
drmrbrewer
  • 8,355
  • 11
  • 60
  • 138
17
votes
1 answer

AppWidgetManager getAppWidgetIds returning old Widget ids

I'm trying to get a list of all ACTIVE instances of my widget. In the OnUpdate method of my AppWidgetProvider, I'm doing the following: // Get all ids ComponentName thisWidget = new ComponentName(context, this.getClass()); int[] lastWidgetIds =…
Cigogne Eveillée
  • 2,060
  • 20
  • 32
17
votes
1 answer

How to observe contentprovider change? android

I'v created a Contentprovide and implements it's update() method like this: @Override public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) { final SQLiteDatabase db = mHelper.getWritableDatabase(); int…
herbertD
  • 9,587
  • 12
  • 46
  • 74
1
2 3
63 64