android-appwidget

How can I update the UI for an android appwidget

痴心易碎 提交于 2019-12-08 00:23:53
问题 I'm sure I'm missing something, but I'm just trying to get an app widget with a button and a counter. Every time I click the button I want the counter to update by 1. I've set the onUpdate() function of the WidgetProvider to register a pending event to the button so that it starts a service to bump the counter numbver: Intent active = new Intent(context, CounterService.class); active.setAction(CounterService.COUNT); PendingIntent pending = PendingIntent.getService(context, 0, active,

Get other applications icon uri?

给你一囗甜甜゛ 提交于 2019-12-07 11:21:04
问题 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. 回答1: Try android.resource://

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

时间秒杀一切 提交于 2019-12-07 04:37:25
问题 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

App Widget: can you specify a minimum AND a default size?

为君一笑 提交于 2019-12-07 03:44:59
问题 When you design an app widget, you specify a minimum width and height for that widget. When the user places a new widget, the minimum width and height appear to translate across to a default widget size (in terms of blocks). In other words, the initial widget layout appears to correspond to the minimum widget size specified (which they can subsequently resize). Is it possible to specify that you want the widget initially to be laid out according a default size, whilst also setting the minimum

App widget with listview

半世苍凉 提交于 2019-12-06 16:40:39
I have some problem. I'm working with Android 2.2 and now I want to create widget with ListView. But after a lot of time as I seeking answer, I was discovered that it's impossible for this version. But maybe anyone know how I can realise similar effect? How I can to realize the effect of scrolling in App Widget in Android 2.2? Thanks in advance. I found solution for this question. I can use android-support library. 来源: https://stackoverflow.com/questions/8846743/app-widget-with-listview

How can you create a widget inside an android application? (Use App Widget Host class?)

▼魔方 西西 提交于 2019-12-06 14:50:24
问题 I need to create an application that contains multiple widgets. These are not desktop widgets. I need to be able to interact with these widgets as if they were desktop widgets, but they need to be encased inside a larger application. (Each widget has it's own functionality and behavior when clicked.) Is this possible in android? Or do I need to create an application and create each object that I'd like to behave like a widget actually as a view? Ex. The parent app is for a car. Example of "in

Android create Spannable which does not wrap

自古美人都是妖i 提交于 2019-12-06 06:37:53
问题 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

Android AppWidget Configuration - Start in new task

天大地大妈咪最大 提交于 2019-12-06 06:24:45
问题 I've searched and searched and searched for this! So I've got an app widget and it has a configuration activity that I can open when pressing a button on the app. The scenario is: Had the app opened. Closed the app with the home button. Selected to add my widget I have configured the widget. Placed on my home screen Then open the configuration activity again with the button on the widget. Cancel the new config by pressing back will put me back into the app. When pressing back I want to just

Android appWidget multiple instances

你。 提交于 2019-12-06 05:11:44
问题 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

How to Launch an Android AppWidget's configuration Activity from another activity?

╄→尐↘猪︶ㄣ 提交于 2019-12-06 04:21:47
问题 Well this is driving me crazy. I have developed an App-widget. Everything is working fine. I have a configuration activity which launches every time a widget is added on the home screen and works beautiful. I save the user settings per widget id etc. The widget has some buttons, one of them launches an activity with about information, the "About Activity". The "About Activity" has a button which I want to use to launch the configuration activity for the widget id that launched the "About