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. Unable to add jars into dex

Hi,

D:\softwares\android\android-sdk-windows-1.5_r3\platforms\android-1.5\tools>dx
-
-dex --output=classes.dex
osgi-android\bundle\org.apache.felix.shell-1.0.2.jar
warning: Ignoring InnerClasses attribute for an anonymous inner class that
doesn
't come with an associated EnclosingMethod attribute. (This class was
probably p
roduced by a broken compiler.)
D:\softwares\android\android-sdk-windows-1.5_r3\platforms\android-1.5\tools>aapt
 add osgi-android\bundle\org.apache.felix.shell-1.0.2.jar classes.dex
 'classes.dex'...
Unable to add 'classes.dex' to
'osgi-android\bundle\org.apache.felix.shell-1.0.2
.jar': already exists in archive

Does anybody know this issue?


Ashok Jeevan

-- 

2. Global search button removes my dialog, any help to ignore phone's search button click?

Hi Dear,

my activity shows help dialog when it starts but as soon as i click
the click search button on the phone, search dialog appears and my
dialog goes away.

i can ignore the search key in my activity like below but it is still
working when i have any dialog on top

@Override
    public boolean onSearchRequested() {
       return false;
    }

any idea how can i ignore search action completely for my dialog

Thanks

-- 

3. Problems with Google Map View tutorial

4. In Gps app, Reduce the Distance & Time to 5m/10min , 10m/25sec.

5. Why 2 less Zoom levels in API than in Google Maps App in my Area

6. how enable LAN in eclairs

7. Keyevent not support the long-pressed behavior entering screen-off mode