Skip to main content

Home/ Android Dev/ Group items tagged widget

Rss Feed Group items tagged

Kiran Kuppa

Card UI - 0 views

    "Ever wondered about Google play store UI which is built around cards. Card is nothing but a single row item of ListView or GridView. As depicted below, card can be of various sizes and can be either app card, movie, books, games or app suggestions card or birthday card or even it can be a simple list/grid item too.

    The main benefit of designing app with card UI is it gives consistent looks throughout the application, doesn't matter whether it gets loaded in mobile or tablet."
Kiran Kuppa

New Layout Widgets: Space and GridLayout - 0 views

    "Ice Cream Sandwich (ICS) sports two new widgets that have been designed to support the richer user interfaces made possible by larger displays: Space and GridLayout."
Kiran Kuppa

Android: Dynamic and Custom Title Bars - 0 views

    Arguably the worst part in playing around with Android is its insistence to put that ugly title bar above everything I do as a default to Activities. Thankfully, the framework allows one to change this behavior.This post is going to explore the ways in which we can create custom title bars and more importantly just how far we can push the limits.
Vincent Tsao

译言网 | 如何发挥 Android 锁定屏幕的潜力 - 0 views

  • Android 的某些功能着实让人喜爱,而另一些尚需改进。我们觉得 Google 应该改进的一个地方就是 Android 的待机锁定屏幕的可用性。Android 的优秀的小工具框架能让它在一瞥之间提供不少信息。现在的这个空旷的锁定屏幕一定可以得到增强(这对于平板电脑来说非常合适),而多亏了一些应用程序,Android 可以做到这一点
Vincent Tsao

Widget(s) and Pending intent - Android Developers | Google Groups - 0 views

  • Then i've tried PendingIntent.FLAG_UPDATE_CURRENT i'm no longer
    crashing, but it always launches the activity with extras were put in
    the widget that was updated the last. It looks like pending intent is
    shared among my widget instances
  • I've changed the call to
     PendingIntent pending = PendingIntent.getActivity(context,
    appWidgetId, intent, PendingIntent.FLAG_UPDATE_CURRENT);
    Now everything is cool except based on discussions i'm not sure how
    reliable it'll be . ( Doc says it's not supported yet )
Vincent Tsao

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.

    • Vincent Tsao
      good explanation
  • 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);

    In TVWidget class:

            public void onReceive(Context context, Intent intent) {

                    String action = intent.getAction();

                    if (action != null && action.equals(UPDATE_ACTION)) {
                            final AppWidgetManager manager = AppWidgetManager.getInstance
                            onUpdate(context, manager,
                                            manager.getAppWidgetIds(new ComponentName(
                                                            context, TVWidget.class)

                    else {
                            super.onReceive(context, intent);

    This seems to work fine.

Vincent Tsao

Creating a Home Screen App Widget on Android - - 0 views

  • The Android system reuses Intents that match both action and scheme values—the "extras" values are not compared
    • Vincent Tsao
  • In practice, this means the Intent for each App Widget identifier would actually be the same Intent. Fortunately, the solution is straightforward: define a scheme for your App Widget and use it to define unique Intent instances
  • // make this pending intent unique widgetUpdate.setData( Uri.withAppendedPath(Uri.parse( ImagesWidgetProvider.URI_SCHEME + "://widget/id/"), String.valueOf(appWidgetId)));
Vincent Tsao

Creating a Home Screen App Widget on Android - - 0 views

  • onReceive(): The default implementation of this method handles the BroadcastReceiver actions and makes the appropriate calls to the methods shown above. (Warning: A well-documented defect exists that requires the developer to handle certain cases explicitly. See the following note for more information.)
    • Creating a simple App Widget involves several steps:

      1. Create a RemoteView, which provides the user interface for the App Widget.
      2. Tie the RemoteView to an Activity that implements the AppWidgetProvider interface.
      3. Provide key App Widget configuration information in the Android manifest file.
  • An App Widget is basically just a BroadcastReceiver that handles specific actions.
Vincent Tsao

putExtra error on AppWidget - Android Developers | Google Groups - 0 views

  • I am just making some AppWidget and I want to pass some Strings
    through UpdateView to an Activity. But the Bundle is null.

    I try this:
                          Intent defineIntent = new Intent(context,
                           PendingIntent pendingIntent =
    PendingIntent.getActivity(context, 0, defineIntent, 0);
    (, pendingIntent);
              Bundle b = intent.getExtras();
                    if (b == null) {

    b is always null.

  • Remember that PendingIntents aren't keyed using extras:

    You could hack the extras through by mangling them into Uri
    parameters, or if you're using a ContentProvider, just point to a
    specific row.

  • Or use PendingIntent.FLAG_UPDATE_CURRENT; just be careful that each active
    instance has its own unique Intent.
Vincent Tsao

Handling User Interaction with Android App Widgets - - 0 views

  • An App Widget uses a special display control called RemoteViews. Unlike a regular View, a RemoteViews control is designed to display a collection of View controls in another process. Consequently, you can't simply add a button handler because that code would run in your application process, not in the process displaying the RemoteViews object (in this case, the Home Screen process).
    • In order to handle user interaction with an App Widget, the following tasks must be performed:

      1. Set a unique click handler for each App Widget control
      2. Have the click handler send a command to a registered receiver
      3. Process the command received and perform any action necessary
      4. Update the App Widget to reflect the changes
Vincent Tsao

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 onclick
    Intent i = new Intent(this, MyWidget.class);
    PendingIntent pi = PendingIntent.getBroadcast(context,0, i,0);
Simon Pan

App Widgets | Android Developers - 1 views

  • To find your minimum width and height in density-independent pixels (dp), use this formula:
    (number of cells * 74) - 2
    • Simon Pan
      why i can't highlight?
    • Vincent Tsao
      FYI: You may need a toolbar to highlight,
  • how often the App Widget framework should request an update from the AppWidgetProvider by calling the onUpdate() method
  • exactly on time
  • ...6 more annotations...
  • programmatically interface with the App Widget, based on broadcast events.
  • programmatically interface with the App Widget, based on broadcast events.
  • programmatically interface with the App Widget, based on broadcast events.
  • only the event broadcasts
  • when each App Widget is added to a host
  • it includes a loop that iterates through each entry in appWidgetIds,
Vincent Tsao

Widget Design Guidelines | Android Developers - 1 views

  • In portrait orientation, each cell is 80 pixels wide by 100 pixels tall (the diagram shows a cell in portrait orientation)
  • In landscape orientation, each cell is 106 pixels wide by 74 pixels tall.
1 - 15 of 15
Showing 20 items per page