android-appwidget

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

对着背影说爱祢 提交于 2019-12-05 20:59:40
问题 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

Update issue of an app widget using collection

自作多情 提交于 2019-12-05 19:28:15
问题 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:

Update app widget on click in android

落花浮王杯 提交于 2019-12-05 17:38:32
I am working on Android Widget my widget is like following diagram, [prev] event name [next] prev, next are the buttons on the widget.So i want to update the event name on click of next and prev button.On start of the service i loaded the data and stored it in array list. Now i want to iterate through the array list by clicking the next and prev buttons on the widget. So how can i achieve this.Please help me with proper solution. Here is my xml layout <LinearLayout android:id="@+id/lytWidget2" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop=

Get other applications icon uri?

守給你的承諾、 提交于 2019-12-05 13:58:17
I have an Android appwidget which shows icons of other applications on it. I get the other applications icons with appInfo.loadIcon and then I set it to the widgets with setImageViewBitmap. The problem is that if I have too many icons on the widget, I get "FAILED BINDER TRANSACTION" error. I understand that it's from a size limit and the solution it to use the image uri instead of the bitmap itself. Is there an accessible URI to other applications' icons? Thanks. Try android.resource://[package]/[res type]/[res name] , where [res type] in your case would be drawable . The package and name

Is it safe to rely on the call to onDataSetChanged() after onCreated() in RemoteViewsFactory of an AppWidget

核能气质少年 提交于 2019-12-05 06:08:45
I developed my AppWidget according to the android doc, loading my cursor in onCreate() and reloading it in onDataSetChanged() , and everything worked fine, until I set some breakpoints in my RemoteViewsService.RemoteViewsFactory and surprisingly found that onDataSetChanged() is always called after the call to onCreate() , which made my cursor loaded twice when first created. I'm on Android 4.4.3. According to the Api doc , public abstract void onDataSetChanged () Added in API level 11 Called when notifyDataSetChanged() is triggered on the remote adapter. This allows a RemoteViewsFactory to

Multiple widget sizes

拟墨画扇 提交于 2019-12-05 02:16:41
问题 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

ProgressBar in an AppWidget

有些话、适合烂在心里 提交于 2019-12-04 21:18:22
问题 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

How to set time to Android AnalogClock in app widget?

*爱你&永不变心* 提交于 2019-12-04 21:09:38
How to set custom time to Android AnalogClock placed in app widget? As an alternative I was thinking to override default AnalogClock to set the time through codes. Or in other words, I would create my custom Clock which extends from default View or AnalogClock. Then put my custom Clock on widget layout UI. Is this possible? I'm afraid we are limited on RemoteViews to have our own custom Component. UPDATE: This is error log I have following the solution given by vArDo at first. Intro It's not possible to include custom views in app widgets. According to documentation only small predefined

Android create Spannable which does not wrap

被刻印的时光 ゝ 提交于 2019-12-04 14:47:33
I have a following issue with laying out text on Android. I'm basically trying to have two lines of text with minimal spacing and each should be styled differently. I've had quite good working solution with two singlelined TextViews one placed below the other, but I've been still getting a little bit cropped text on certain devices.. So I decided to switch to just one TextView an use Spannables instead which should be generally a better solution in all circumstances. That means I needed to remove the single line property from my TextView -> in order to be able to wrap the line before starting

AppWidget click lost after system restarts my process

心不动则不痛 提交于 2019-12-04 12:21:57
i am making an appwidget and i have problems with click event, which is lost when system kills the widget's process and later restarts it. this also happens after screen rotate. building against SDK version 7 and running on emulator (2.1) and a real device with 2.3.3. my onUpdate method: public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { for (int wid : appWidgetIds) { Log.i(TAG, "onUpdate widget #" + wid); Intent intent = new Intent(context, MyClass.class); intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, wid); PendingIntent clickIntent =