android-appwidget

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

梦想与她 提交于 2019-12-17 23:22:10
问题 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 app widget containing a collection (with a listview) of items. But the user needs to select something, so I need a configuration activity. The configuration activity is a ListActivity : @TargetApi(Build.VERSION_CODES.HONEYCOMB) public class

failed binder transaction on widget update

北城以北 提交于 2019-12-17 19:55:24
问题 i am updating one bitmap in widget (the whole widget is only one ImageView) like this remoteViews.setImageViewBitmap(...) and in some rare situations (it happend 3 times in 6 months of every day use) i get "!!! FAILED BINDER TRANSACTION !!!". then, only phone reboot solves this problem. uninstaling and installing again, does not help, only reboot. i checked the icon's size and it is only 56 kilobytes, so it fits within the IPC memory limit. when i remove setImageViewBitmap(...) the widget

AppWidget click lost after system restarts my process

删除回忆录丶 提交于 2019-12-14 03:42:08
问题 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

app widget setImageViewUri does not update the image

妖精的绣舞 提交于 2019-12-13 11:58:51
问题 i have an app widget, which contains only one imageview. i redraw that image and store it as png in apps's private memory and then i set the RemoteViews' image with the uri (widget.setImageViewUri(R.id.widget_icon, uri)) instead of sendding the bitmap it self, because in very rare situations i get !!! FAILED BINDER TRANSACTION !!! the problem is, that as the image changes over time, the widget's image does not change. i checked the saved png with root explorer and it is updated correctly. but

Appwidget keeps reseting background to transparent

拥有回忆 提交于 2019-12-13 05:38:59
问题 I created functionality in an appwidget that allows a user to change the background from transparent to semi-transparent. The default is set to transparent in the xml. When the user changes the background preference the setting is saved and the background is updated using below code: public static Bitmap setBackground (int bgcolor) { { Bitmap.Config config=Bitmap.Config.ARGB_8888; Bitmap bitmap=Bitmap.createBitmap(2, 2, config); Canvas canvas=new Canvas(bitmap); canvas.drawColor(bgcolor);

AppWidget Button onClick stops working

早过忘川 提交于 2019-12-12 17:06:40
问题 I have a widget I'm trying to build that consists of only a button. What I'm wanting to do is have the button clicked and then run some simple piece of code (in my test it's a toast alert). It seems to work fine initially, but suddenly the button stops responding to clicks. I've noticed it consistently after the phone has been asleep. Here is my code for the AppWidgetProvider. onUpdate: for (int appWidgetId : appWidgetIds) { RemoteViews remoteView = new RemoteViews(context.getPackageName(), R

Can't make a toast from thread in an AppWidgetProvider class

给你一囗甜甜゛ 提交于 2019-12-12 12:27:11
问题 I have an appwidget that can download some data from a web service (in a thread in onReceive() ) by clicking on it. After that is finished the GUI of the widget gets updated in updateWidget(...) (= re-drawn). I want to make a toast when this is done. I tried a lot like to make a toast at the end of updateWidget(...) by passing the context from the thread to the toast, but that didn't work. The problem seems to be the context. Because my class inherits from AppWidgetProvider and NOT from

Avoiding FAILED BINDER TRANSACTION error when updating lots of widget bitmaps

僤鯓⒐⒋嵵緔 提交于 2019-12-12 07:31:51
问题 I am coming across an error when I am updating my RemoteViews in my AppWidget. .. !!! FAILED BINDER TRANSACTION !!! This is caused because all the changes to the RemoteViews are serialised (e.g. setInt and setImageViewBitmap ). The bitmaps are also serialised into an internal bundle. Unfortunately this bundle has a very small size limit. I cannot use setImageResource as I am hoping to allow the user to download skins for the widget. Can anyone recommend a workaround for this problem? I am

How to add checkboxes in Android App toolbar?

99封情书 提交于 2019-12-12 06:24:45
问题 I need to add a Checkbox in Android App bar . my Menu_main as follow: <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" tools:context=".MainActivity"> <item android:id="@+id/action_search" android:title="search" android:icon="@drawable/ic_search" app:showAsAction="ifRoom|collapseActionView" app:actionViewClass="android.support.v7.widget.SearchView" /> </menu> Right now it's

launch update of listview inside appwidget when button is pressed android

血红的双手。 提交于 2019-12-12 05:29:51
问题 I have an appwidget which contains a listview and a buton the listview gives data from remote mysql database mysql and it display it but the button I want to us it to refresh listview from appwidget directly and don't wait for time defined in appwidgetinfo here is my widgetprovider class : public class WidgetProvider extends AppWidgetProvider { // String to be sent on Broadcast as soon as Data is Fetched // should be included on WidgetProvider manifest intent action // to be recognized by