Widget update with Context.sendBroadcast()

by Carl » Wed, 04 Nov 2009 17:53:07 GMT


Sponsored Links
 Hello all,


I would like to update my AppWidget only, without interfering with the
other widgets in the system.
I created the following code, but I am not sure it other widgets will
also update, since I am using Context.sendBroadcast().

Intent myWidgetUpdate= new Intent
("android.appwidget.action.APPWIDGET_UPDATE");
myWidgetUpdate.setClassName("com.package.name",
"com.package.name.mywidget");
sendBroadcast(myWidgetUpdate);

In the reference it is written:

sendBroadcast(Intent intent, String receiverPermission)
Broadcast the given intent to all interested BroadcastReceivers...

Does this means that even if I specify the exact class to send the
intent to, other unrelated widgets will also be udpated?

Thank you.

Carl

--



Widget update with Context.sendBroadcast()

by Justin Anderson » Thu, 05 Nov 2009 00:35:12 GMT


 I believe that "interested BroadcastReceivers" means the ones that match the
intent.

Given your sample code it seems to me that only your widget will be updated.

Thanks,
Justin

----------------------------------------------------------------------
There are only 10 types of people in the world...
Those who know binary and those who don't.
----------------------------------------------------------------------





>


Sponsored Links


Widget update with Context.sendBroadcast()

by Mark Murphy » Fri, 06 Nov 2009 06:47:08 GMT


 


Why not just:

-- bind to the IntentService that is supporting your widget and call a
method on there to update to widget? Or

-- create your own Intent that your AppWidgetProvider listens to in
addition to the official one, and broadcast that custom Intent?

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://twitter.com/commonsguy 

_Android Programming Tutorials_ Version 1.0 Available!

--



Other Threads

1. android emulator takes over sound card

Hello:
  I have notice that on Kubuntu (or ubuntu), when I run the Android emulator
the sound cards cannot be used by any other programs.  This is not a big
problem to develop programs, but just wanted to inform the community.  As
soon as the emulator is shutdown the sound card is accesible to other
programs.

--~--~---------~--~----~------------~-------~--~----~

2. Wifi access

Hi, i'm totally new in Android but i'm very interested in developing
applications using Wifi, mainly I'd like to know if it exist an API to
access to Wifi module and all the parameters. Thanks

--~--~---------~--~----~------------~-------~--~----~

3. Without XML

4. NullPointer Exception error at simple application

5. My App screenshots

6. Developer Strategy Pitfalls

7. Here is my developed Android App screenshots.