alright Thanks for the guidance mate. I will update u, thanks again.
cheers :)

On Feb 9, 8:54 pm, Kristopher Micinski <[email protected]> wrote:
> On Thu, Feb 9, 2012 at 11:44 AM, Soyer <[email protected]> wrote:
> > so it's an order issue, Could you please instruct me which part should
> > i change?, because honestly i have read loads of articles and i don't
> > think i am going anywhere which getting more n more frustrating...
>
> > That would be Very Appreciated.
>
> It's not an order issue.
>
> You're thinking that you call .startDiscovery() and then it starts
> discovering devices and tells you which there are.
>
> It doesn't work like that.
>
> Discovery can take a long time, tens of seconds into minutes.
>
> If your call to .startDiscovery() blocked until the discovery was finished,
> your program would ANR and crash....
>
> Instead, when you call .startDiscovery() what happens is that you're asking
> the operating system "start looking for BT devices, when you finish looking
> for them, broadcast that you're done and I'll ask what you found, even
> though this will probably take a long time."
>
> So you need to register the BroadcastReceiver to handle the Bluetooth
> discovery finished action.
>
> Have you read the BluetoothChat example.  I feel like if you had then you
> wouldn't be asking this, go read that and it should make sense.  And if it
> doesn't then go read about what a BroadcastReceiver is in the first place.
>
> Basically: you're writing your code like it runs in a straight line, it
> doesn't, it runs asynchronously, so you have to structure your code
> differently.
>
> kris

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to