android - Google Places Autocomplete API not retrieving place suggestions -


i'm using google places autocomplete api in application. followed tutorial http://wptrafficanalyzer.in/blog/adding-google-places-autocomplete-api-as-custom-suggestions-in-android-search-dialog/ when write place name in search box, doesn't retrieves suggestions , when press go button, app crashes. please help

log file

03-10 16:51:56.383: e/activitythread(25238): failed find provider info com.appscourt.earth.map.placeprovider 03-10 16:51:58.798: e/activitythread(25238): failed find provider info com.appscourt.earth.map.placeprovider 03-10 16:51:59.594: e/activitythread(25238): failed find provider info com.appscourt.earth.map.placeprovider 03-10 16:52:00.399: e/activitythread(25238): failed find provider info com.appscourt.earth.map.placeprovider 03-10 16:52:01.805: e/activitythread(25238): failed find provider info com.appscourt.earth.map.placeprovider 03-10 16:52:06.298: e/activitythread(25238): failed find provider info com.appscourt.earth.map.placeprovider 03-10 16:52:06.313: d/androidruntime(25238): shutting down vm 03-10 16:52:06.313: w/dalvikvm(25238): threadid=1: thread exiting uncaught exception (group=0x40d072a0) 03-10 16:52:06.344: e/androidruntime(25238): fatal exception: main 03-10 16:52:06.344: e/androidruntime(25238): java.lang.nullpointerexception 03-10 16:52:06.344: e/androidruntime(25238):    @ com.appscourt.earth.map.location.mainactivity.showlocations(mainactivity.java:129) 03-10 16:52:06.344: e/androidruntime(25238):    @ com.appscourt.earth.map.location.mainactivity.onloadfinished(mainactivity.java:116) 03-10 16:52:06.344: e/androidruntime(25238):    @ com.appscourt.earth.map.location.mainactivity.onloadfinished(mainactivity.java:1) 03-10 16:52:06.344: e/androidruntime(25238):    @ android.support.v4.app.loadermanagerimpl$loaderinfo.callonloadfinished(loadermanager.java:427) 03-10 16:52:06.344: e/androidruntime(25238):    @ android.support.v4.app.loadermanagerimpl$loaderinfo.onloadcomplete(loadermanager.java:395) 03-10 16:52:06.344: e/androidruntime(25238):    @ android.support.v4.content.loader.deliverresult(loader.java:104) 03-10 16:52:06.344: e/androidruntime(25238):    @ android.support.v4.content.cursorloader.deliverresult(cursorloader.java:73) 03-10 16:52:06.344: e/androidruntime(25238):    @ android.support.v4.content.cursorloader.deliverresult(cursorloader.java:35) 03-10 16:52:06.344: e/androidruntime(25238):    @ android.support.v4.content.asynctaskloader.dispatchonloadcomplete(asynctaskloader.java:223) 03-10 16:52:06.344: e/androidruntime(25238):    @ android.support.v4.content.asynctaskloader$loadtask.onpostexecute(asynctaskloader.java:61) 03-10 16:52:06.344: e/androidruntime(25238):    @ android.support.v4.content.modernasynctask.finish(modernasynctask.java:461) 03-10 16:52:06.344: e/androidruntime(25238):    @ android.support.v4.content.modernasynctask.access$500(modernasynctask.java:47) 03-10 16:52:06.344: e/androidruntime(25238):    @ android.support.v4.content.modernasynctask$internalhandler.handlemessage(modernasynctask.java:474) 03-10 16:52:06.344: e/androidruntime(25238):    @ android.os.handler.dispatchmessage(handler.java:99) 03-10 16:52:06.344: e/androidruntime(25238):    @ android.os.looper.loop(looper.java:137) 03-10 16:52:06.344: e/androidruntime(25238):    @ android.app.activitythread.main(activitythread.java:5059) 03-10 16:52:06.344: e/androidruntime(25238):    @ java.lang.reflect.method.invokenative(native method) 03-10 16:52:06.344: e/androidruntime(25238):    @ java.lang.reflect.method.invoke(method.java:511) 03-10 16:52:06.344: e/androidruntime(25238):    @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:792) 03-10 16:52:06.344: e/androidruntime(25238):    @ com.android.internal.os.zygoteinit.main(zygoteinit.java:555) 03-10 16:52:06.344: e/androidruntime(25238):    @ dalvik.system.nativestart.main(native method) 

mainactivity.java

public class mainactivity extends fragmentactivity implements         loadercallbacks<cursor> {      googlemap gmap;     imagebutton search;      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main);         initializemap();         handleintent(getintent());         search = (imagebutton)findviewbyid(r.id.search);         search.setonclicklistener(new onclicklistener() {              @override             public void onclick(view v) {                 // todo auto-generated method stub                 onsearchrequested();             }         });     }      private void handleintent(intent intent) {         if (intent.getaction().equals(intent.action_search)) {             dosearch(intent.getstringextra(searchmanager.query));         } else if (intent.getaction().equals(intent.action_view)) {             getplace(intent.getstringextra(searchmanager.extra_data_key));         }     }      @override     protected void onnewintent(intent intent) {         super.onnewintent(intent);         setintent(intent);         handleintent(intent);     }      private void dosearch(string query) {         bundle data = new bundle();         data.putstring("query", query);         getsupportloadermanager().restartloader(0, data, this);     }      private void getplace(string query) {         bundle data = new bundle();         data.putstring("query", query);         getsupportloadermanager().restartloader(1, data, this);     }      @override     public boolean oncreateoptionsmenu(menu menu) {         // inflate menu; adds items action bar if present.         getmenuinflater().inflate(r.menu.main, menu);         return true;     }       @override     public boolean onmenuitemselected(int featureid, menuitem item) {         // todo auto-generated method stub         switch (item.getitemid()) {         case r.id.action_search:             onsearchrequested();             break;          default:             break;         }         return super.onmenuitemselected(featureid, item);     }      @override     public loader<cursor> oncreateloader(int arg0, bundle query) {         cursorloader cloader = null;         if (arg0 == 0)             cloader = new cursorloader(getbasecontext(),                     placeprovider.search_uri, null, null,                     new string[] { query.getstring("query") }, null);         else if (arg0 == 1)             cloader = new cursorloader(getbasecontext(),                     placeprovider.details_uri, null, null,                     new string[] { query.getstring("query") }, null);         return cloader;     }      @override     public void onloadfinished(loader<cursor> arg0, cursor c) {         // todo auto-generated method stub         showlocations(c);     }      @override     public void onloaderreset(loader<cursor> arg0) {         // todo auto-generated method stub      }      private void showlocations(cursor c) {         markeroptions markeroptions = null;         latlng position = null;         gmap.clear();         while (c.movetonext()) {             markeroptions = new markeroptions();             position = new latlng(double.parsedouble(c.getstring(1)),                     double.parsedouble(c.getstring(2)));             markeroptions.position(position);             markeroptions.title(c.getstring(0));             gmap.addmarker(markeroptions);         }         if (position != null) {             cameraupdate cameraposition = cameraupdatefactory                     .newlatlng(position);             gmap.animatecamera(cameraposition);         }     }      @suppresslint("newapi")     private void initializemap() {          if (gmap == null) {              gmap = ((supportmapfragment) getsupportfragmentmanager().findfragmentbyid(                     r.id.map)).getmap();             // check if map created or not             if (gmap == null) {                 toast.maketext(getapplicationcontext(),                         "sorry! unable create maps", toast.length_short)                         .show();             }         }     }    } 

public void onloadfinished(loader<cursor> arg0, cursor c) {     // todo auto-generated method stub     showlocations(c); } 

my guess cursor null. have checked that?


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -