dictionary - Android Google Map Api Latlng String cannot be cast to Double -


i'm using node.js loopback framework, , trying locations of hospitals. , keep getting

 "java.lang.classcastexception: java.lang.string cannot cast java.lang.double @ " on  markeroptions options = new markeroptions()                                 .position(new latlng(hospital.getgeolocation().get("lat"), hospital.getgeolocation().get("lng")))                                 .title(hospital.getname()); 

this error though there not seem casting-related error. made sure hospital.getgeolocation().get("lng") returns double type. don't know problem is! please, me!

floatingsearchview.setonsearchlistener(new floatingsearchview.onsearchlistener() {             @override             public void onsuggestionclicked(final searchsuggestion searchsuggestion) {                 hospitalrepository.search(immutablemap.of("filter[where][name][like]", searchsuggestion.getbody()), new listcallback<hospital>() {                     @override                     public void onsuccess(list<hospital> hospitalobjects) {                         log.i("tag", hospitalobjects.tostring());                         recycleradapter.swapdata(hospitalobjects);                         ismapmovedbysearch = true;                         googlemap.clear();                         latlngbounds.builder builder = new latlngbounds.builder();                         for(hospital hospital : hospitalobjects) {                             log.i("tag", hospital.tostring());                             double lat = hospital.getgeolocation().get("lat").doublevalue();                             double lng = hospital.getgeolocation().get("lng").doublevalue();                              latlng latlng1 = new latlng(lat, lng);                             markeroptions options = new markeroptions()                                     .position(latlng1)                                     .title(hospital.getname());                             builder.include(googlemap.addmarker(options).getposition());                         }                         latlngbounds bounds = builder.build();                         cameraupdate cu = cameraupdatefactory.newlatlngbounds(bounds, 0);                         googlemap.movecamera(cu);                     }                     public void onerror(throwable t){                         log.e("error", "not connected loopback server!");                         log.e("error", "trace", t);                     }                 });                 mlastquery = searchsuggestion.getbody();               }              @override             public void onsearchaction(string query) {                 mlastquery = query;                 hospitalrepository.search(immutablemap.of("filter[where][name][like]", query), new listcallback<hospital>() {                     @override                     public void onsuccess(list<hospital> hospitalobjects) {                          ismapmovedbysearch = true;                         googlemap.clear();                         latlngbounds.builder builder = new latlngbounds.builder();                          for(hospital hospital : hospitalobjects) {                             log.i("tag", "lag :" + hospital.getgeolocation().get("lat") );                             log.i("tag","lng :" + hospital.getgeolocation().get("lng"));                             markeroptions options = new markeroptions()                                     .position(new latlng(hospital.getgeolocation().get("lat"), hospital.getgeolocation().get("lng")))                                     .title(hospital.getname());                             //builder.include(googlemap.addmarker(options).getposition());                             googlemap.addmarker(options);                         }                         recycleradapter.swapdata(hospitalobjects);                         latlngbounds bounds = builder.build();                         cameraupdate cu = cameraupdatefactory.newlatlngbounds(bounds, 0);                         googlemap.movecamera(cu);                     }                      public void onerror(throwable t){                         log.e("error", "not connected loopback server!");                         log.e("error", "trace", t);                     }                 });             }         }); 

logcat

e/error: not connected loopback server! e/error: trace          java.lang.classcastexception: java.lang.string cannot cast java.lang.double              @ com.yeomiae.dev.redmom.fragments.hospitalfragment$4$1.onsuccess(hospitalfragment.java:432)              @ com.strongloop.android.loopback.callbacks.jsonarrayparser.onsuccess(jsonarrayparser.java:31)              @ com.strongloop.android.remoting.adapters.adapter$jsonarraycallback.onsuccess(adapter.java:138)              @ com.strongloop.android.remoting.adapters.adapter$jsoncallback.onsuccess(adapter.java:81)              @ com.strongloop.android.remoting.adapters.restadapter$callbackhandler.onsuccess(restadapter.java:220)              @ com.loopj.android.http.asynchttpresponsehandler.handlemessage(asynchttpresponsehandler.java:276)              @ com.loopj.android.http.asynchttpresponsehandler$responderhandler.handlemessage(asynchttpresponsehandler.java:134)              @ android.os.handler.dispatchmessage(handler.java:102)              @ android.os.looper.loop(looper.java:135)              @ android.app.activitythread.main(activitythread.java:5430)              @ java.lang.reflect.method.invoke(native method)              @ java.lang.reflect.method.invoke(method.java:372)              @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:913)              @ com.android.internal.os.zygoteinit.main(zygoteinit.java:706) 

try case :

double lat = double.parsedouble(hospital.getgeolocation().get("lat")); 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -