android google maps my location
Posted
by
windblow
on Stack Overflow
See other posts from Stack Overflow
or by windblow
Published on 2012-11-16T22:49:34Z
Indexed on
2012/11/16
22:59 UTC
Read the original article
Hit count: 156
I have google maps activity where i would like to get my location but im facing NullPointerException...
locManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
locManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, this);
Location location = locManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
System.out.println("loaded4");
myPoint = new GeoPoint((int)(location.getLatitude()*1E6),(int)(location.getLongitude()*1E6));
System.out.println("loaded5");
I am able to get "loaded4" but not "loaded5" So NullPointer cause is between them. I also tried to use GPS_PROVIDER but it didnt work out.
Yes i have all permissions in manifest. Map is able to load in if im not searhing for my loacation.
Is it possible its NullPointer because before that i load some other coordinates in same class ? Maybe its emulator fault ? I can give extended code if needed. Using source from http://www.chupamobile.com/tutorial/details/53
© Stack Overflow or respective owner