Frage

I wrote an app that plots my position on the google map API using LocationManager ...

It was working perfectly on my device. I turned off my device (switched off) and closed my Eclipse IDE ...

After I started my app again later, the app says " THe app stopped unexpectedly" and I had to force close ...

I don't know what the problem is ...!!

I tried running it from the IDE and the same problem ...

BUT I shared the code with some friends before it crashed and they were running it using the same Google map API key /

Does anyone know what's causing the error ... (Error is Fatal Exception : Main)

A part of code that may be of importance...

try{

         int longTemp = (int)(lastKnownLoc.getLongitude()* 1000000);
         int latTemp = (int)(lastKnownLoc.getLatitude() * 1000000);
         gp =  new GeoPoint(latTemp, longTemp);

} catch (Exception e) {

}

I need help asap .

War es hilfreich?

Lösung

Your lastKnownLoc may be null. You need to check if there is a LastKnownLocation before use it

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top