Kostya,

Thanks.  That worked like a charm.

I noticed in sample AppWidget code that does not use a service, that it
iterates the appWidgetIds array so that it updates all instances of the
widget.  However, in sample code that uses a Service, that iteration is
not done.  Is that because it is not needed for some reason?  How would
one update multiple instances using a service-based solution?

Thanks.

...Jake

>>>>> "KV" == Kostya Vasilyev <kmans...@gmail.com> writes:

   KV> Jake,

   KV> The error is in the way your code instantiates ComponentName.

   KV> Instead of:

   KV> ComponentName thisWidget = new ComponentName(this, 
ZMUpdateService.class);

   KV> Do this:

   KV> ComponentName thisWidget = new
   KV> ComponentName(this,*ZmanMinderAppWidget*.class);

   KV> The error message was trying to convey same thing...

   KV> -- Kostya

   KV> 23.06.2010 17:39, Jake Colman ?????:
   >> I am trying to create a simple AppWidget using a service to initialize
   >> the content in the onUpdate() method.  The data is not being refreshed
   >> and logcat shows me the following warning:
   >> 
   >> AppWidgetService  W  updateAppWidgetProvider: provider doesn't exist:
   >> ComponentInfo{com.jnc.zmanminder/com.jnc.zmanminder.ZMUpdateService}
   >> 
   >> I must be missing something obvious but I cannot figure it out.
   >> 
   >> My AppWidget class (edited for brevity) looks as follows:
   >> 
   >> public class ZmanMinderAppWidget extends AppWidgetProvider {
   >> public void onUpdate(Context context,
   >> AppWidgetManager appWidgetManager, int[] appWidgetIds) {
   >> context.startService(new Intent(context, ZMUpdateService.class));
   >> }
   >> }
   >> 
   >> My Service class (edited for brevity) looks as follows:
   >> 
   >> public class ZMUpdateService extends Service {
   >> public void onStart(Intent intent, int startId) {
   >> RemoteViews updateViews = buildUpdate(this);
   >> ComponentName thisWidget = new ComponentName(this,
   >> ZMUpdateService.class);
   >> AppWidgetManager manager = AppWidgetManager.getInstance(this);
   >> manager.updateAppWidget(thisWidget, updateViews);
   >> }
   >> 
   >> public IBinder onBind(Intent arg0) {
   >> return null;
   >> }
   >> 
   >> public RemoteViews buildUpdate(Context context) { 
   >> Time time = new Time();
   >> time.setToNow();  
   >> RemoteViews views = new
   >> RemoteViews(context.getPackageName(),R.layout.widget);
   >> views.setTextViewText(R.id.time, time.format("%I:%M%p"));
   >> return views;
   >> }
   >> }
   >> 
   >> The ZMUpdateService service is defined in my manifest file.
   >> 
   >> Thanks for any help.
   >> 
   >> ...Jake
   >> 
   >> 
   >> 

   KV> -- 
   KV> Kostya Vasilev -- WiFi Manager + pretty widget --
   KV> http://kmansoft.wordpress.com

   KV> -- 
   KV> You received this message because you are subscribed to the Google
   KV> Groups "Android Beginners" group.

   KV> NEW! Try asking and tagging your question on Stack Overflow at
   KV> http://stackoverflow.com/questions/tagged/android

   KV> To unsubscribe from this group, send email to
   KV> android-beginners+unsubscr...@googlegroups.com
   KV> For more options, visit this group at
   KV> http://groups.google.com/group/android-beginners?hl=en

-- 
Jake Colman -- Android Tinkerer

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to