onInfoWindowClick Method not working in android -


i have create app showing current location in maps.i want show places in toast message under oninfowindowclick method. toast not working .thanks in advance help!

here code :

public  class searchproviderlocation extends activity implements locationlistener,oninfowindowclicklistener   {  class myinfowindowadapter implements infowindowadapter{      private final view mycontentsview;      myinfowindowadapter(){         mycontentsview = getlayoutinflater().inflate(r.layout.custom_info_contents, null);     }      @override     public view getinfocontents(marker marker) {          textview tvtitle = ((textview)mycontentsview.findviewbyid(r.id.title));         tvtitle.settext(marker.gettitle());         textview tvsnippet = ((textview)mycontentsview.findviewbyid(r.id.snippet));         tvsnippet.settext(marker.getsnippet());          return mycontentsview;     }      @override     public view getinfowindow(marker marker) {         // todo auto-generated method stub         return null;     }  }   final int rqs_googleplayservices = 1; textview tvlocinfo; googlemap map; private locationmanager locationmanager; protected locationlistener locationlistener; protected context context; string provider; double latitude; protected double longitude;  protected boolean gps_enabled,network_enabled;  private string val,val1; private static final long minimum_distance_change_for_updates = 1; // in meters private static final long minimum_time_between_updates = 1000; // in milliseconds  boolean isgpsenabled ;  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_search_provider_location);       try {          locationmanager lm = (locationmanager) getsystemservice(context.location_service);            lm.requestlocationupdates(locationmanager.network_provider, 0, 0, this);                map = ((mapfragment) getfragmentmanager().findfragmentbyid(r.id.map))                 .getmap();                 map.setinfowindowadapter(new myinfowindowadapter());           }            catch (exception e) {             e.printstacktrace();                         } }   @override public void onlocationchanged(location location) {     // todo auto-generated method stub      map.clear();      geocoder geo = new geocoder(this.getapplicationcontext(), locale.getdefault());   try {         list<address> addresses = geo.getfromlocation(location.getlatitude(), location.getlongitude(), 1);          markeroptions mp = new markeroptions();             mp.position(new latlng(location.getlatitude(), location.getlongitude()));            mp.icon(bitmapdescriptorfactory.fromresource(r.drawable.marker));             mp.snippet("address:"+" "+" "+addresses.get(0).getfeaturename()+" "+addresses.get(0).getadminarea()+" "+addresses.get(0).getlocality()+" "+addresses.get(0).getpostalcode()+""+addresses.get(0).getcountrycode());            mp.title(addresses.get(0).getlocality()+", "+addresses.get(0).getcountryname());             map.addmarker(mp);            map.animatecamera(cameraupdatefactory.newlatlngzoom(             new latlng(location.getlatitude(), location.getlongitude()), 14));    } catch (ioexception e) {         // todo auto-generated catch block         e.printstacktrace();     }  }  @override protected void onresume() {     super.onresume();      int resultcode = googleplayservicesutil.isgoogleplayservicesavailable(getapplicationcontext());      if (resultcode == connectionresult.success){         toast.maketext(getapplicationcontext(),                  "googleplayservicesavailable",                  toast.length_long).show();     }else{         googleplayservicesutil.geterrordialog(resultcode, this, rqs_googleplayservices);         } }  public void onmaplongclick(latlng point) {     tvlocinfo.settext("new marker added@" + point.tostring());      marker newmarker = map.addmarker(new markeroptions()                                 .position(point)                                 .snippet(point.tostring()));     newmarker.settitle(newmarker.getid());  } @override public void oninfowindowclick(marker marker) {    marker.gettitle();    final string ssid = marker.gettitle();      toast.maketext(getbasecontext(),"you click @" + ssid,toast.length_short).show();  }  @override public void onproviderdisabled(string provider) {  }  @override public void onproviderenabled(string provider) {   }                     @override public void onstatuschanged(string arg0, int arg1, bundle arg2) {     // todo auto-generated method stub  }} 

try below code:

map.setoninfowindowclicklistener(new oninfowindowclicklistener() {     @override public void oninfowindowclick(marker arg0) {         final string ssid = arg0.gettitle();          toast.maketext(searchproviderlocation.this,"you click @" + ssid,toast.length_short).show();     } });  

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? -