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

992 questions
4
votes
2 answers

Ellipsized, multi-line text in an AppWidget?

What appeared to be a simple requirement is becoming quite a painful process. I need an AppWidget to show some (usually multi-line) text - the text will vary in size, and may be longer than the view allows, so needs ellipsizing in that case. The…
Ollie C
  • 28,313
  • 34
  • 134
  • 217
4
votes
1 answer

How to add an widget in code to the home screen

I am trying to write a simple launcher application.In that I am trying to add a default widget like android clock.I am loading all the information of default widgets like x,y positions,width and height and package informations.After loading this I…
Joshua
  • 442
  • 1
  • 5
  • 20
4
votes
1 answer

Android onEnabled() lifecycle after process was killed

According to the documentation the lifecycle of the AppWidgetProvider class is managed by the Android platform. The documentation also states that the lifecycle method onEnabled() is only called once. But how about widgets that were removed because…
Erwin
  • 41
  • 2
4
votes
1 answer

Rename AppWidgetProvider without breaking existing widgets

I found recently that after I renamed my class that extends AppWidgetProvider (as part of a code tidy-up), and installed the modified app, existing widgets would break, displaying just "Problem loading widget". Adding a fresh widget to the home…
drmrbrewer
  • 11,491
  • 21
  • 85
  • 181
4
votes
2 answers

After extracting code to lib widget is no longer working

I had a perfectly working widget as part of my project. Then I decided to extract common code (including the widget) into the library project. After doing this everything works except the widget. It appears in the list of widgets available for…
Bostone
  • 36,858
  • 39
  • 167
  • 227
4
votes
3 answers

how to attach a onClick Listener to a listview item on an app widget

I like to add a onClick Listener to every item of my listview, but nothing what I have tried work. Here is my RemoteViewsFactory: public class MyRemoteViewsFactory implements RemoteViewsService.RemoteViewsFactory { [...] public RemoteViews…
Wookiee
  • 139
  • 2
  • 12
4
votes
0 answers

Android Widget: RemoteViewsFactory does not display items correctly if getViewAt() method takes too long to execute

I have an android widget that displays user thumbnails in a GridView. The code follows the android sample code for implementing a widget that shows a collection. Here is the code for my getViewAt() method: @Override public RemoteViews getViewAt(int…
James Busby
  • 119
  • 11
4
votes
2 answers

AppCompatCheckBox not working for below API 21

I created a dynamic checkbox with the following code: xml:
user3997016
4
votes
0 answers

How to Share Android Screenshot dynamically by button click

I am working on an app which requires specifically to take a screenshot of the screen and should be able to share it as a image file. I also need to include a hyperlink as caption to the image for Watsapp and Facebook. I am using the below code…
Doogle
  • 1,236
  • 1
  • 17
  • 17
4
votes
2 answers

onDataSetChanged is not called in RemoteViewsFactory after notifyAppWidgetViewDataChanged is called

I'm trying to implement android app with widget, but found strange behavior on nexus 5 devices (i have two - one with lollipop, one with marshmallow). If I call AppWidgetManager.notifyAppWidgetViewDataChanged, widget's ListView content is refreshed…
Pew Pew
  • 63
  • 7
4
votes
2 answers

Updating AppWidget

I'm launching an activity on a buttonclick from AppWidget. The user enters some data on the activity and when user closes the activity, I want to update the data user entered in a TextView on AppWidget. Any idea how to do that? I have successfully…
Amit Chintawar
  • 20,450
  • 1
  • 17
  • 17
4
votes
0 answers

Android app widget crashes launcher after indefinite length of time

I have a really strange problem with my app widget. There's no issues with dragging it to the homescreen, configuration or even functionality. Everything works as expected. But, after an arbitrary length of time, my launcher starts to crash. I've…
4
votes
2 answers

How to list ALL home screen widgets

In my app, I want to list ALL home screen widgets. My code is like this: mWidgetInfoList = AppWidgetManager.getInstance(getActivity()).getInstalledProviders(); int count = 0; for (AppWidgetProviderInfo one: mWidgetInfoList) { Log.d(TAG,…
wizardlee
  • 53
  • 6
4
votes
2 answers

Android appwidget ViewStub

I am trying to develop a rather complicated appwidget which could change part of it programmatically. Android suggests for such things to use ViewStub widget. According to AppWidgets page RemoteViews supports ViewStub. Because when working with…
mlykotom
  • 4,850
  • 1
  • 22
  • 27
4
votes
0 answers

Android AppWidgetProvider: How To Interpret Min/Max Width/Height

I'm currently attempting to create an Android AppWidget that is 4x1 cells initially, but can be resized vertically by the user. I created a class that extends AppWidgetProvider, and overrode the onAppWidgetOptionsChanged() method to examine the…
Luke
  • 2,187
  • 1
  • 18
  • 29