android-appwidget

App Widget not displaying in ICS app drawer

删除回忆录丶 提交于 2019-12-01 19:41:14
问题 Has anyone experienced their app widget not being listed in the ICS app drawer? Originally I started this app for FroYo and below, which supports the app widget just fine. Along came Gingerbread and Honeycomb, those work too. The widget appears in the list in the emulator if I open up the "Widget Preview" app, however when you just open the drawer it isn't listed with the others. It does appear on Honeycomb. I don't (and others haven't also) see it on my Galaxy Nexus anywhere either. I've

How to find view id in appwidgetprovider?

蓝咒 提交于 2019-12-01 17:34:27
问题 I have a appwidget extends from appwidgetprovider. I have created a layout xml file named main_layout.xml and add a button. If i develop a listActivity i reach this button with this path: R.layout.main_layout.button01. (Button)findViewById(R.layout.main_layout.button01) Activity class has a member method that named findViewById() but appwidgetprovider has not. How can i reach my button in my layout? sorry for my english 回答1: You can never reference or modify views in Appwidget directly. You

Android widget not updating - has incorrect widget ID

非 Y 不嫁゛ 提交于 2019-12-01 15:33:55
I've been working on a widget and making some advances (I hope) but still can't get it to do what I want. I have a configurator activity which works ok. When it closes I call the updateAppWidget method in the WordWidget class and the widget updates the random number. What I can't do it get the random number to change because of onClick. According to the log I do enter the onReceive() method, but thats about it. In the log I'm printing the widget ID. I noticed that when run from the configurator activity it's printing appWidgetId=33, but when I press the widget it prints appWidgetId=24. This is

Android widget not updating - has incorrect widget ID

陌路散爱 提交于 2019-12-01 15:18:06
问题 I've been working on a widget and making some advances (I hope) but still can't get it to do what I want. I have a configurator activity which works ok. When it closes I call the updateAppWidget method in the WordWidget class and the widget updates the random number. What I can't do it get the random number to change because of onClick. According to the log I do enter the onReceive() method, but thats about it. In the log I'm printing the widget ID. I noticed that when run from the

AppWidgetProvider: not called onEnabled method

天涯浪子 提交于 2019-12-01 12:38:10
I have widget that display data from content provider. I want to know when data in content provider changes. As far as I know way to do it is context.getContentResolver().registerContentObserver But AppWidgetProvider.onEnabled method is not called when I add first instance of the widget. That's why I can't make registerContentObserver . The same with onDisabled. How to solve this problem? Thanks You need to add android.appwidget.action.APPWIDGET_ENABLED as another action: <intent-filter> <action android:name="android.appwidget.action.APPWIDGET_UPDATE" /> <action android:name="android.appwidget

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

别等时光非礼了梦想. 提交于 2019-12-01 12:06:52
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? In the AppWidgetProvider XML file there is an attribute called android:configure You can use this to point to an Activity to launch when the app is dropped onto the home screen. ex: <?xml version="1.0" encoding=

onUpdate() intilized variable are null in onReceive of widget class

给你一囗甜甜゛ 提交于 2019-12-01 11:33:36
问题 I initialize one variable in an onUpdate() method and after that I call onReceive() function which runs fine but cannot access varible set in onUpdate() method. Why is that? Those varible is string variableand are declared public. Am I missing something? public class WidgetTest extends AppWidgetProvider { public static String ACTION_WIDGET_RECEIVER = "ActionReceiverWidget"; public String state; public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { Log

Scrollable TextView in Android Widget

╄→尐↘猪︶ㄣ 提交于 2019-12-01 11:28:46
I would like to create an android widget with a scrollable textview. The solutions given to this question Making TextView scrollable on Android cannot be applied because it is a widget: 1. This findViewById(R.id.textview).setMovementMethod(new MovementMethod()); does not work, since findViewById is not available in AppWidgetProvider but only in Activity . 2.Putting a ScrollView around the TextView also does not work, because I get an InflateException : android.view.InflateException: Binary XML file line #23: Error inflating class ScrollView Can anybody give me a hint, how to make a TextView in

Scrollable TextView in Android Widget

我是研究僧i 提交于 2019-12-01 09:40:39
问题 I would like to create an android widget with a scrollable textview. The solutions given to this question Making TextView scrollable on Android cannot be applied because it is a widget: 1. This findViewById(R.id.textview).setMovementMethod(new MovementMethod()); does not work, since findViewById is not available in AppWidgetProvider but only in Activity . 2.Putting a ScrollView around the TextView also does not work, because I get an InflateException : android.view.InflateException: Binary

4x4 appwidgets are detected as 3x3 on tablets

拟墨画扇 提交于 2019-12-01 06:41:29
I create an 4x4 appwidget with minWidth and minHeight set to "250dp" as it is suggested in App Widget Design Guidelines: http://developer.android.com/guide/practices/ui_guidelines/widget_design.html It is ok on every phones and phone-sized emulator I have tried but if I test it on a tablet (Xoom or Nexus 7) or on an emulator (resolution: 1280x752 with dpi 160) then the launcher detects it as 3x3 widget. What am I doing wrong? Thanks, Tamas Try grid size = (74*n) - 2 for older api level. This value come from old document. 来源: https://stackoverflow.com/questions/11868015/4x4-appwidgets-are