MartinM wrote:
> The following code works fine, so I know that locationManager is
> valid:
> 
>        locationManager = (LocationManager)
> getSystemService(Context.LOCATION_SERVICE);
>        String prvdr = LocationManager.GPS_PROVIDER;
>        locationManager.getAllProviders();
> 
> 
> 
> However, this doesn't, and the Eclipse debugger deosn't help as it
> can't find the source cos Google doesn't supply it
> 
>        Location lct = locationManager.getLastKnownLocation(prvdr) ;
> 
> 
> I'm a bit stuck at this - any ideas on the problem or how to debug
> better?

You could look at the exception.

MartinM wrote:
> Sorry, to be more precise, it throws an exception, but not a useful
> one!

No, I'm fairly certain it will be useful.

Most likely, that line is fine, but you then fail later on a
NullPointerException when trying to use the Location. If so, that is
because there is no fix, perhaps because you haven't done anything in
code to attempt to get GPS to start acquiring fixes, such as call
requestLocationUpdates().

If that is not the exception you are getting, then please post the
exception and stack trace (and relevant portion of your source code).

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

Android Training in NYC: 4-6 June 2010: http://guruloft.com

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to