android-appwidget

Flashlight widget does not turn off

旧时模样 提交于 2019-12-23 03:01:52
问题 I have created everything necessary for my widget to exist and function. Even so at the first click, t does what it is supposed to but then image gets changed and says problem, and does not function. I want it to open flash and then close it. Help will be much appreciated. FlashlightWidgetProvider public class FlashlightWidgetProvider extends AppWidgetProvider { @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { Intent receiver = new

Android widget not responding to touches

点点圈 提交于 2019-12-23 01:52:06
问题 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

How to change the ProgressBar color in a widget?

流过昼夜 提交于 2019-12-21 21:55:46
问题 Is there any way to change the color of the ProgressBar residing in the app widget at runtime? This is how the ProgressBar progress value is updated: RemoteViews views = new RemoteViews( context.getPackageName(), R.layout.widget ); views.setProgressBar( R.id.progressbar, 100, 10, false ); ... appWidgetManager.updateAppWidget( widgetID, views ); Unfortunately, the RemoteViews class does not allow us to set a color filter or even a different progress drawable for ProgressBar . Any ideas would

Set position of TextView in RemoteView during runtime

為{幸葍}努か 提交于 2019-12-21 10:55:09
问题 Dear all, I am trying to set the position of a TextView within an appwidget. Basically, the direct access to properties af the TextView works: myRemoteView.setTextColor(R.id.myTextView, Color.WHITE); //works Also indirectly, I can access the TextView properties: myRemoteView.setInt(R.id.myTextView, "setTextColor", Color.BLUE); // works And setting float values also works: myRemoteView.setFloat(R.id.myTextView, "setTextSize", 25); // works Now I'm trying to shift the x position of the TextView

Remote ListView blinks on android widget

空扰寡人 提交于 2019-12-20 04:10:47
问题 I am having an unexpected bothering issue with a remote listview. My app has a simple widget which includes a listview. If the listview has 1 cell height and the listview is at the beginning of its scroll it blinks/flahses everytime datasetchanged is called. The funny thing is that if the listview has more than 1 cell height or if it has 1 cell height BUT it has been scrolled down a bit it doesnt blink. Could anybody please provide some suggestion? I am frustrated. Solutions I have thought so

How to show an actitivity only when an app widget is first created?

ぃ、小莉子 提交于 2019-12-19 10:58:20
问题 My app widget needs to be configured when it first added to the home screen. I want to open a configuration view right after the user adds the widget. AppWidgetProvider has no onCreated event, so I'm showing the confugration activity on the onUpdate event, and store a boolean value in SharedConfiguration that marks that the configuration has already been shown. Is there an easier way? 回答1: In the AppWidgetProvider XML file there is an attribute called android:configure You can use this to

Auto Screen Rotation Disabling Widget RemoteView onClick event

两盒软妹~` 提交于 2019-12-19 06:27:08
问题 I have a bit of a strange bug with a widget I've coded- after the screen rotates the widget stops responding to onClick events. The code is exactly the same as in the Android Developer Documentation for App Widgets here. I've noticed other widgets from the market don't have this problem- is there a known workaround perhaps? I've tried tapping all over the place after a rotation so I don't think its the onClickPendingIntent not being resized after a rotation; it doesn't seem to be present at

Add several appWidgets with different configuration?

寵の児 提交于 2019-12-19 04:05:18
问题 I've created a widget which displays a simple textview, which is editable as an Edittext in a configuration activity. I save the inputted text with shared preferences, so the user can tap the widget to edit the text, and the already inputted text appears in the edittextfield. My problem is this. I would like the user to be able to add multiple widgets, but when a seccond widget is added, the same text as in the other widget is loaded from shared preferences. And, when on widget is edited so

Creating A Digital Clock Widget With A Custom Font

流过昼夜 提交于 2019-12-18 14:57:21
问题 I'm trying to create a digital clock widget with a custom font. And this has proven to be the biggest challenge of my Android experience. (Thought it would be as simple as tc.setTypeFace("whatever") and be done with it) The best way seems to be scratch the TextClock and use an ImageView and pass a Bitmap to it using a custom AlarmManager to create a new image for the view each second. Before I get into the Bitmap generation, I practiced on a simple TextView using this tutorial Alarm Manager

ViewFlipper in app widgets

空扰寡人 提交于 2019-12-18 13:32:00
问题 I'm playing around building a new widget and was looking at the Android app widget documentation, in particular the section on which widget classes were supported. I noticed that ViewFlipper is supported, but I'm struggling to find any examples on how to use one in a home screen widget. In particular, I'm wondering if its possible to manually trigger swapping views. In an activity this looks relatively straightforward, one example being hooking up the onclick listener of a button to call the