To find your minimum width
and height in density-independent pixels (dp), use this formula:
(number of cells * 74) - 2
Group items matching
in title, tags, annotations or url
11More
App Widgets | Android Developers - 1 views
-
-
FYI: You may need a toolbar to highlight, http://www.diigo.com/tools/toolbar
-
how often the App Widget framework should request an update from the AppWidgetProvider by calling the onUpdate() method
- ...6 more annotations...
2More
The CommonsBlog - Activity or Notification via Ordered Broadcast - 0 views
-
I’ve run into the following generalized question a lot recently: I have an event that occurs in the background. I want to update my activity, if the activity is on the screen. Otherwise, I want to raise a Notification.
-
Hence, the recipe for the activity-or-Notification pattern is: Define an action string you will use when the event occurs that you want to go to the activity or notification (e.g., com.commonsware.java.packages.are.fun.EVENT). Dynamically register a BroadcastReceiever in your activity, with an IntentFilter set up for the aforementioned action string and with a positive priority (the default priority for a filter is 0). This receiver should then have the activity do whatever it needs to do to update the UI based on this event. The receiver should also call abortBroadcast() to prevent others from getting it. Be sure to register the receiver in onStart() or onResume() and unregister the receiver in the corresponding onStop or onPause() method. Register in your manifest a BroadcastReceiver, with an <intent-filter> set up for the aforementioned action string. This receiver should raise the Notification. In your service (e.g., an IntentService), when the event occurs, call sendOrderedBroadcast(). And that’s it. If the activity is on-screen, its receiver will be registered, so it will get the event, process it, and cancel the Broadcast. If the activity is not on-screen, its receiver will not be registered, so the event will go to the default handler, in the form of your manifest-registered BroadcastReceiver, which will raise the Notification.
4More
Android Cloud to Device Messaging Framework - Google Projects for Android - 1 views
-
It allows third-party application servers to send lightweight messages to their Android applications. The messaging service is not designed for sending a lot of user content via the messages. Rather, it should be used to tell the application that there is new data on the server, so that the application can fetch it. C2DM makes no guarantees about delivery or the order of messages. So, for example, while you might use this feature to tell an instant messaging application that the user has new messages, you probably would not use it to pass the actual messages. An application on an Android device doesn’t need to be running to receive messages. The system will wake up the application via Intent broadcast when the the message arrives, as long as the application is set up with the proper broadcast receiver and permissions.
-
It uses an existing connection for Google services. This requires users to set up their Google account on their mobile devices.
-
C2DM imposes the following limitations: The message size limit is 1024 bytes. Google limits the number of messages a sender sends in aggregate, and the number of messages a sender sends to a specific device
- ...1 more annotation...
-
The ClientLogin token authorizes the application server to send messages to a particular Android application. An application server has one ClientLogin token for a particular 3rd party app, and multiple registration IDs. Each registration ID represents a particular device that has registered to use the messaging service for a particular 3rd party app.
4More
How to implement a Button on an Android Widget - Stack Overflow - 0 views
-
I am just getting started with Android development and I have created a nice little widget that displays some info on my home screen. However, I now want to implement a Button on my widget that updates the info in my widget TextView.
-
Solved - I can confirm that an Activity is NOT needed if you want create a Button to update an Android AppWidget. I have been able to implement my AppWidgetProvider class such that it registers an android.appwidget.action.APPWIDGET_UPDATE intent-filter with the Broadcast receiver in the AndroidManifest.xml, which then fires the onUpdate event in the AppWidgetProvider class (which in turn then runs the UpdateService).
-
The UpdateService in my AppWidgetProvider class then uses onHandleIntent to run a private buildUpdate method - which registers the onClick event with a call to setOnClickPendingIntent as follows:
- ...1 more annotation...
-
// set intent and register onclickIntent i = new Intent(this, MyWidget.class);PendingIntent pi = PendingIntent.getBroadcast(context,0, i,0);updateViews.setOnClickPendingIntent(R.id.update_button,pi);
3More
Is it possible to update a widget from an Activity? - Android Developers | Google Groups - 0 views
-
An AppWidgetProvider is a BroadcastReceiver. That gives you two possibilities right off the bat: 1. Have it also handle whatever other Intents you were planning on setting up with a separate BroadcastReceiver, or 2. Send an Intent from whatever component you want to the AppWidgetProvider. In other words, don't worry about trying to talk directly to the app widget (which I suspect is impossible) -- just talk to your code that already talks to the app widget.
-
I update my widget from within my app, when I delete/add entries to a list. To do this, I have a method (updateWidget) and a static String (UPDATE_ACTION). My updateWidget() method sends a broadcast which is received by the widget class and then calls onUpdate() with the appropriate params: private void updateWidget() { Intent i = new Intent(this, TVWidget.class); i.setAction(TVWidget.UPDATE_ACTION); sendbroadcast(i); } In TVWidget class: @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (action != null && action.equals(UPDATE_ACTION)) { final AppWidgetManager manager = AppWidgetManager.getInstance (context); onUpdate(context, manager, manager.getAppWidgetIds(new ComponentName( context, TVWidget.class) ) ); } else { super.onReceive(context, intent); } } This seems to work fine.
2More
Introducing Droid-Fu for Android: BetterActivity, BetterService and BetterAsy... - 2 views
-
So the basic idea is: launch an AsyncTask making your service call, show a nifty progress dialog while the task thread is running, and have the task’s result be posted back to your activity once it completes. Cool, but what if the user decides to rotate the screen while your task is running? Or a phone call comes in, interrupting your app, and Android decides to kill it? Both these actions will effectively terminateyour activity, and recreate it when resuming (yes, a screen rotation kills your activity, very clever, isn’t it?). Unfortunately, any AsyncTask that was still running now holds a stale reference to your activity, because the restarted activity will be an entirely different object in memory (and it will go through onCreate(), as if the activity had started for the first time). I’m not entirely sure whether AsyncTask will actually post back the data to the old activity object (if it was a weak reference, it may already have been garbage collected), but in any case, your “new” activity will never see it, because it’s a different instance.
6More
kaeppler/droid-fu - GitHub - 6 views
-
Droid-Fu offers both support classes meant to be used alongside existing Android code, as well as self-contained, ready-to-be-used components like new adapters and widgets. The areas tackled by Droid-Fu include: application life-cycle helpers support classes for handling Intents and diagnostics better support for background tasks super-easy and robust HTTP messaging powerful caching of Objects, HTTP responses, and remote images custom adapters and views I suggest you read this introductory article, and anything that follows.
- ...2 more comments...
-
BetterAsyncTask本质就是AsyncTask,我想在用法上应该没有太大区别 但AsyncTask有个硬伤就是它的life-cycle对当前的activity的life-cycle有依赖,容易引起FC,而BetterAsyncTask解决了这个问题,Ref: http://groups.diigo.com/group/android_related/content/introducing-droid-fu-for-android-betteractivity-betterservice-and-betterasynctask-brain-flush-2838716 当然还有其他解决办法,我自己偏向于 IntentService + Broadcast mechanism的解决方案
26More
In-app Billing Overview | Android Developers - 1 views
-
nonce
- ...22 more annotations...
-
even though your application has sent a CONFIRM_NOTIFICATIONS message. This can occur if a device loses network connectivity while you are sending the CONFIRM_NOTIFICATIONS message.