I could be wrong about this due to inexperience, but due to the nature
of the looper, if you put it on the main looper and the GPS decides to
randomly disappear for seconds then the GUI freezes along with it. I
don't know if that really happen in reality, but I imagine the
possibility could occur. If you want to make sure that the location
updates don't mess up your UI you could always do something like:
class MyLocThread extends Thread
{
public MyLocThread ()
{
setDaemon(true);
setName("LocationThread");
}
public void run()
{
Looper.prepare();
lm.requestLocationUpdates(
LocationManager.GPS_PROVIDER,
0L,
0L,
locListenerGPS,
Looper.getLooper()
);
Looper.loop();
}
}
On Sep 29, 8:35 am, Pent <[email protected]> wrote:
> Is there anything wrong with specifying the main thread looper to
> handle messages about location update like this:
>
> lm.requestLocationUpdates(
> LocationManager.GPS_PROVIDER,
> 0L,
> 0L,
> locListenerGPS,
> Looper.getMainLooper()
> );
>
> (call is made from a non-UI thread)
>
> Am I going to start getting weird unexplicable errors in other places
> due to the looper voodoo ?
>
> Thanks,
>
> Pent
--
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