Hola.
Una cosa que parece sencilla me esta dando problemas y no encuentro el fallo. Lo único que quiero es calcular la distancia entre dos puntos (Uno de ellos es mi posición).
Este es el código dentro del método onInfoWindowClick.
double distance;
LatLng point = new LatLng(43.318703, -1.927353);
instLoc.setLatitude(point.latitude);
instLoc.setLongitude(point.longitude);
//loc es un obejto de tipo Location que guarda mi posición
distance = (int)loc.distanceTo(instLoc);
Este es el error:
12-27 17:47:50.890: W/dalvikvm(20301): threadid=1: thread exiting with uncaught exception (group=0x4185fba8)
12-27 17:47:50.890: E/AndroidRuntime(20301): FATAL EXCEPTION: main
12-27 17:47:50.890: E/AndroidRuntime(20301): Process: com.kirolm.myapp, PID: 20301
12-27 17:47:50.890: E/AndroidRuntime(20301): java.lang.NullPointerException
12-27 17:47:50.890: E/AndroidRuntime(20301): at com.kirolm.myapp.maps.MapActivity.onInfoWindowClick(MapActivity.java:327)
12-27 17:47:50.890: E/AndroidRuntime(20301): at com.google.android.gms.maps.GoogleMap$7.e(Unknown Source)
12-27 17:47:50.890: E/AndroidRuntime(20301): at com.google.android.gms.internal.co$a.onTransact(Unknown Source)
12-27 17:47:50.890: E/AndroidRuntime(20301): at android.os.Binder.transact(Binder.java:361)
12-27 17:47:50.890: E/AndroidRuntime(20301): at cmt.a(SourceFile:82)
12-27 17:47:50.890: E/AndroidRuntime(20301): at maps.af.bj.b(Unknown Source)
12-27 17:47:50.890: E/AndroidRuntime(20301): at maps.ao.o.W_(Unknown Source)
12-27 17:47:50.890: E/AndroidRuntime(20301): at maps.ao.o.a(Unknown Source)
12-27 17:47:50.890: E/AndroidRuntime(20301): at maps.ao.an.b(Unknown Source)
12-27 17:47:50.890: E/AndroidRuntime(20301): at maps.ao.bc.onSingleTapConfirmed(Unknown Source)
12-27 17:47:50.890: E/AndroidRuntime(20301): at maps.br.g.onSingleTapConfirmed(Unknown Source)
12-27 17:47:50.890: E/AndroidRuntime(20301): at maps.br.i.handleMessage(Unknown Source)
12-27 17:47:50.890: E/AndroidRuntime(20301): at android.os.Handler.dispatchMessage(Handler.java:102)
12-27 17:47:50.890: E/AndroidRuntime(20301): at android.os.Looper.loop(Looper.java:136)
12-27 17:47:50.890: E/AndroidRuntime(20301): at android.app.ActivityThread.main(ActivityThread.java:5017)
12-27 17:47:50.890: E/AndroidRuntime(20301): at java.lang.reflect.Method.invokeNative(Native Method)
12-27 17:47:50.890: E/AndroidRuntime(20301): at java.lang.reflect.Method.invoke(Method.java:515)
12-27 17:47:50.890: E/AndroidRuntime(20301): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
12-27 17:47:50.890: E/AndroidRuntime(20301): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
12-27 17:47:50.890: E/AndroidRuntime(20301): at dalvik.system.NativeStart.main(Native Method)
Haber si se os ocurre algo. Tengo la sensación de que se me pasa algo muy sencillo peor no caigo.
Saludos y gracias