android-appwidget

Android appWidget multiple instances

↘锁芯ラ 提交于 2019-12-04 09:06:48
This question is pretty much a duplicate of Android - Multiple appWidgets playing different sounds , but my code isn't working. I am adding an intent extra with the widget id, with log statements to prove it, but whenever I click on one of my widgets when there are multiple instances of it, I only get the last appWidgetId. It looks like the intent of the first widget is changing after the second one is added. If the code in that other post should work, then I must be overlooking something because I believe mine is set up pretty much the same way. public class PhcaAppWidgetProvider extends

Calculate height of appwidget

大城市里の小女人 提交于 2019-12-04 08:58:35
I cannot figure out or find a solution by googling for this problem. I have an android app with an appwidget, looks like http://www.livescorewidget.eu/img/screendumps/widget.png , and I am adding the data rows on the fly. Due to different devices the height of the widget is different and therefore a different amount of space is available for my rows. I want to know how many dips or pixels my widget uses so I can calculate how many rows there is room for. Is it possible? Even better could be if you could calculate how much height available in the layout for the rows. Thanks From Jelly Bean

AppWidget refresh Uri for RemoteViews

为君一笑 提交于 2019-12-04 04:59:27
问题 I have created an Appwidget that displays an image file (test.png) that is provided to it's RemoteViews via Uri. In onUpdate i run a service that changes the content of the file. I have also set an onClickListener for the image that will call onUpdate. -If I create an instance of the AppWidget it displays the most recently changed version of the Uri file. -If I click the widget, my service makes the approporaite changes to the file (which I can verify with a file explorer), but it does not

Set position of TextView in RemoteView during runtime

ぐ巨炮叔叔 提交于 2019-12-04 04:23:22
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 by 5 pixels: myRemoteView.setFloat(R.id.myTextView, "setTranslationX", 5); // does not work

Android AppWidgetManager method updateAppWidget fails to set intents, load data. And it happens randomly

↘锁芯ラ 提交于 2019-12-04 03:59:48
My widget is comprised of 2 buttons and a listview displaying data. Most times, when the widget provider's onUpdate method is called, everything loads normally and everyone is happy. However I've noticed sometimes after the update method is called, the widget just completely fails to load its data. The listview is empty, and all of the buttons are non-responsive. It's as if I initialized the layout into the widget, but none of the pending intents nor the adapter for list were set. I logged everything and found that this isn't the case. The pending intents ARE created, as is the list adapter,

Update issue of an app widget using collection

不羁的心 提交于 2019-12-04 02:41:06
I have created an app widget using collection for my app, The widget shows date and list of item on that particular date. Everything works fine and the widget are updating as required, But sometimes what happen while changing the date in the widget by clicking next and previous button, the list is not refresh means the items are not updated on that particular date. This behaviour is random and its occur sometimes only. So why this happen, anything wrong in my code. Code that i have use is: WidgetProvider.class public class WidgetProvider extends AppWidgetProvider { private ThemeManager m

Multiple widget sizes

China☆狼群 提交于 2019-12-03 17:24:59
I was searching in internet but nothing helps. I want to make second widget, just bigger. Im using service to update my widget so I need to create 2 services (update data in widget by remoteviews etc.) or can I make it easier? When I add medium widget, it shows up te small one but it takes more space (144dp x 72dp) and there is no update. Maybe I should copy whole app classes and modify it, but I think this is stupid solution. I was trying this solutions how to add multiple widgets in one app? How to put multiple widget sizes in one apk? Any hints? :) I had the same need with my widget.

FileProvider error

巧了我就是萌 提交于 2019-12-03 16:29:48
问题 https://developer.android.com/training/camera/photobasics.html All I am trying to do is take a picture with the Camera, save it and display it in an ImageView. I followed the android tutorial above and keep getting an error (a NullPointerException) on the line: Uri photoURI = FileProvider.getUriForFile(this, "com.example.android.fileprovider", photoFile); I know I need to configure the FileProvider in my app's manifest and the "authorities" has to match. I don't quite understand what I should

ProgressBar in an AppWidget

为君一笑 提交于 2019-12-03 13:42:37
I ran into an interesting situation with using a ProgressBar in an App Widget... The documentation ( http://developer.android.com/guide/topics/appwidgets/index.html ) says that ProgressBar is a supported widget class... I have no problem getting the ProgressBar to display in my App Widget but the problem is that I want it to only be displayed as visual feedback to the user when background processing is happening. On ImageViews I do this via RemoteViews.setViewVisibility() and everything works fine. However, with ProgressBar I get an exception saying that ProgressBar can't use this method. Is

AppWidgetManager.getAppWidgetIds in activity returns an empty list

梦想与她 提交于 2019-12-03 13:33:22
问题 I have an appwidget that I'm trying to update from an activity. To do that, I need the appwidget id. I've used AppWidgetManager.getAppWidgetIds but it always returns an empty list. I also used AppWidgetManager.getInstalledProviders to make sure that my ComponentName is correct, but still I get an empty list. I've seen all the other questions about this, but I couldn't find something that worked for me. Is there another way to solve this? or another way to update the widget? My code: