RemoteCallbackList.getBroadcastItem(int) sometimes returns null

by Dianne Hackborn » Fri, 13 Mar 2009 09:25:16 GMT


Sponsored Links
 The callbacks are just stored in a HashMap, and the entries there are never
set null (actually that field is final), so I don't really see how that can
happen.  Are you sure you aren't potentially doing this loop from different
threads without doing your own synchronization?

On Thu, Mar 12, 2009 at 6:07 PM, Streets Of Boston



> 



RemoteCallbackList.getBroadcastItem(int) sometimes returns null

by Dianne Hackborn » Fri, 13 Mar 2009 09:27:36 GMT


 m actually could you see if it is the -last- ones that are null?  The code
that makes the list gets a count from the HashMap, and then iterates through
its values and puts them in the array, and returns the original count. So
if that count is different than the number it iterated over, that could be a
problem. I'll change it to return the actual number it iterated over, but
in theory these shouldn't be different.

On Thu, Mar 12, 2009 at 6:25 PM, Dianne Hackborn <hack...@android.com>wrote:



--
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support. All such questions should be posted on public
forums, where I and others can see and answer them.

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


Sponsored Links


RemoteCallbackList.getBroadcastItem(int) sometimes returns null

by Dianne Hackborn » Fri, 13 Mar 2009 16:54:17 GMT


 On Thu, Mar 12, 2009 at 8:08 PM, Streets Of Boston





No, it only locks internally in beginBroadcast() to create the list.  If you
may have multiple threads calling beginBroadcast(), they need to do their
own synchronization, holding your own lock from before calling
beginBroadcast() to after finishBroadcast().

-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support.  All such questions should be posted on public
forums, where I and others can see and answer them.

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



RemoteCallbackList.getBroadcastItem(int) sometimes returns null

by Dianne Hackborn » Sat, 14 Mar 2009 00:59:18 GMT


 On Fri, Mar 13, 2009 at 7:27 AM, Streets Of Boston





I'm not sure what you mean by "either way" -- if you are doing this from
multiple threads, your threads can clobber the list, which can lead to this
kind of problem.

-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support.  All such questions should be posted on public
forums, where I and others can see and answer them.

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



RemoteCallbackList.getBroadcastItem(int) sometimes returns null

by Dianne Hackborn » Sat, 14 Mar 2009 02:29:18 GMT


 If your callbacks are oneway, the easiest thing to do is put it all in a big
synchronized() block.  Be aware though that if the callback is into the
local process, it will still be synchronous, so holding a lock while doing
this can be a problem.

Usually the safest thing is to have a handler that you post a message to,
which does the callbacks.  Then you don't need any locking since the
broadcasts are serialized by the handler.

On Fri, Mar 13, 2009 at 10:55 AM, Streets Of Boston <flyingdutc...@gmail.com







-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support.  All such questions should be posted on public
forums, where I and others can see and answer them.

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



Other Threads

1. Web-browsing issue on OMAP device

Hi,

I have done android  porting on OMAP device.everything is good but
facing problem in web browsing.
i am getting proeper IP address, netmask, gateway, DNS1,DNS2 even then
when i'm trying to browse internet through my browser it shows ''can
not display web site'.

can some tell where the problem is and how can i solve this?

Thanks

-- 
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

2. Mod: Gathering ID-Android with HTC Indonesia (Sabtu, 26 Juni 2010)

Sama nich... Kenapa kalo acara bagus pas bentrok ma acara laen huhuhu.... Coba 
kalo bisa minggu depannya ... Ngarep mode on

Hehehe desire desire..
Sent from BlackBerry on 3

-----Original Message-----
From: "hendra w." <smurf...@gmail.com>
Sender: id-android@googlegroups.com
Date: Fri, 18 Jun 2010 09:16:47 
To: Indonesian Android Community [id-android]<id-android@googlegroups.com>
Reply-To: id-android@googlegroups.com
Subject: [id-android] Re: Mod: Gathering ID-Android with HTC Indonesia (Sabtu, 
        26 Juni 2010)

Waaaa...nubie pengen ikut :) mo liat "jurus2" dari suhu2 yg dah
terkenal negh...tapi sayang nih minggu depan ke bali
...


On Jun 18, 11:11pm, "yopie suryadi" <android.em...@ratjoen.com>


> 

3. Spinner selection dialog without spinner

4. Mod: Gathering ID-Android with HTC Indonesia (Sabtu, 26 Juni 2010)

5. Background apps (Instant Messaging) being killed without user notification

6. Background apps (Instant Messaging) being killed without user notification

7. Google support number for Droid's sent to Developers from Google?