Android Open Source - RandomNumberWidget Widget Random






From Project

Back to project page RandomNumberWidget.

License

The source code is released under:

GNU General Public License

If you think the Android project RandomNumberWidget listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.Widget.RandomNumber;
/*from w ww .jav a  2  s.c  o  m*/


import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

/*
 * Simple widget gives Random Number
 * 
 * @author Patrick Gorman
 * 
 * @version Not Sure
 * eh
 * Needs work!!
 */


public class WidgetRandom extends AppWidgetProvider {

  private static final String LOG = "com.Widget.RandomNumber";

  @Override
  public void onUpdate(Context context, AppWidgetManager appWidgetManager,
      int[] appWidgetIds) {

    Log.w(LOG, "onUpdate method called");
    // Get all ids
    ComponentName thisWidget = new ComponentName(context,
        WidgetRandom.class);
    int[] allWidgetIds = appWidgetManager.getAppWidgetIds(thisWidget);

    // Build the intent to call the service
    Intent intent = new Intent(context.getApplicationContext(),
        WidgetService.class);
    intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, allWidgetIds);

    // Update the widgets via the service
    context.startService(intent);
  }
}




Java Source Code List

com.Widget.RandomNumber.AppWidgetRandom.java
com.Widget.RandomNumber.SetRange.java
com.Widget.RandomNumber.WidgetRandom.java
com.Widget.RandomNumber.WidgetService.java