android-appwidget

Android - how update widget often but only when it is visible?

你离开我真会死。 提交于 2019-11-28 03:29:08
I'm going to create widget which needs to update its content every minute (it shows time-related data). However, there is no need to update widget if it is currently invisible, which means: screen is turned off another app is running widget is placed on another (invisible) home screen tab What is the best way to update only visible widget every minute - without waking up device nor doing unnecessary computations? After widget becomes visible, small lag before update is acceptable. Mark B To keep from updating when the screen is off, use the AlarmManager to schedule a recurring alarm that doesn

How to make a scrollable app widget?

天涯浪子 提交于 2019-11-28 01:20:44
问题 As far as I have read in the Internet and official documentation, it isn't possible to make a scrollable app widget. Also all my tries failed. I even tried to subclass TextView to implement my own scroll method, but nothing worked. Are there any ways to achieve that? Btw.... there are solutions if you use for example htc sense or home desktop ++, but i want to make it available to other users which don't use this 回答1: Are there any ways to achieve that? Not directly. You can always add

AppWidget PendingIntent not working after Launcher restart

女生的网名这么多〃 提交于 2019-11-28 01:18:24
问题 I have an AppWidget with 2 pending intents. They work most of the time, but after a while they stop responding. Only thing I have been able to pinpoint is that they are crippled after a Launcher restart, i.e. I use Launcher Pro, and sometimes fiddle with settings and have to restart it. After that they don't work at all. Here are my onRecieve() and onUpdate() methods: public void onReceive(Context context, Intent intent) { super.onReceive(context, intent); String action = intent.getAction();

How to observe contentprovider change? android

天涯浪子 提交于 2019-11-27 22:12:26
I'v created a Contentprovide and implements it's update() method like this: @Override public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) { final SQLiteDatabase db = mHelper.getWritableDatabase(); int count = db.update(InslideDB.FOLDER_TABLE, values, selection, selectionArgs); /* To notify the observer */ this.getContext().getContentResolver().notifyChange(URI, null); return count; } How can I get notified in my appwidget? Thanks! I'm trying this Resolver but no Log (--------------------Date Changed) print: class DataProviderObserver extends

Binding AppWidgets to AppWidgetHost - Android

泄露秘密 提交于 2019-11-27 18:39:54
问题 When you normally want to add an AppWidget in Android there is a list where you need to pick one widget and it binds it to the home screen. I'm trying to build an app which has its own appWidgetHost and specific App Widgets that I built for it. I have two problems: I would like to be able to automatically bind a widget to my AppWidgetsHost without the user picking from the list. I want to make my own 'pick widgets list' and to load only widgets that I have created. To make it simple; There is

ListView in widget adds randomly items on scrolling and resizing (nested remoteviews)

限于喜欢 提交于 2019-11-27 17:41:18
问题 Update: I created a repository with less code to make it a bit easier to understand. I'm trying to create a widget. I made it like described here: https://stackoverflow.com/a/6093753/2180161 It works partially, but I have a really strange bug. I made a screencast , so it's easier to understand what I mean: http://c.maysi.de/c6H9 Screenshot : As you can see there are some items which were added randomly. ( RemoteViews which were added to another RemoteViews object) The same happens when I

android appwidget won't update from activity

爷,独闯天下 提交于 2019-11-27 16:27:38
问题 I have a simple appwidget and I want to update it when an action occurs in an activity (in the same app). in onUpdate(), I immediately update the widget, which works fine. In my activity, I call the same static update method in my appwidget that is called in onUpdate() to update the views. the widget is not updated. I can trace the code right into the AppWidgetManager.updateAppWidget() method, and all this good, but the widget does not update. The only possible difference I can see is that

Why is my android alarm manager firing instantly?

 ̄綄美尐妖づ 提交于 2019-11-27 16:07:17
问题 I am following sample code for sending an update notification every 10'seconds. The code follows and it is in an UpdateService for an AppWidgetProvider . If I put a Thread.sleep(10*1000); I can see the expected behavior of my servicing loop. I obviously have something fundamentally wrong that is triggering immediately. It is supposed to be a PendingIntent of an alarm that will broadcast update to my listener. long nextUpdate = 10*1000; Log.d(TAG, "Requesting next update in " + nextUpdate + "

ACTION_BATTERY_CHANGED firing like crazy

女生的网名这么多〃 提交于 2019-11-27 13:43:58
Okay, so I'm working on an AppWidget that checks the battery level and displays it on a TextView. My code looks like this: public class BattWidget extends AppWidgetProvider { private RemoteViews views = new RemoteViews("com.nickavv.cleanwidgets", R.layout.battlayout); @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int appWidgetIds[]) { final int N = appWidgetIds.length; context.getApplicationContext().registerReceiver(this,new IntentFilter(Intent.ACTION_BATTERY_CHANGED)); for (int i = 0; i < N; i++) { int appWidgetId = appWidgetIds[i]; appWidgetManager

Widget for turning on/off camera flashlight in android

天大地大妈咪最大 提交于 2019-11-27 10:52:18
I am developing a widget for turning on/off camera led of phone. I have made a widget that can work like toggle button (on/off). Behavior is like follows : Sometimes the led light remains on when i enable the widget. But it doesnot turn on/off the camera led but it changes the icon. I am not able to figure out whats the actual problem. The same thing works fine in Activity (Torch Light Application). Can anyone please explain me how can i solve my problem ? Where i am going wrong ? You can look at the code below that i have done so far onUpdate method @Override public void onUpdate(Context