android google maps my location
- by windblow
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