Android Gmap v2 infowindow click load activity with data based on id of marker -


i have gmap v2 android class populating points on gmap parsing data xml file. xml file contains 3 things want:

  • coordinates
  • name
  • description

on marker click want see info window name in it. can that. on infowindow click, want start new activity name , description in textviews.

i lost @ how can click on infowindow show new activity description corresponding name. tried creating class called mapmarkers , adding each "entry" it, returns string , cannot figure out how grab title it, still have desc available next activity:

public class mapmarkers {     private latlng coor;     private string title;     private string desc;      public mapmarkers() {         super();     }      public mapmarkers(latlng coor, string title, string desc) {         super();         this.coor = coor;         this.title = title;         this.desc = desc;     }      @override     public string tostring() {         return coor + title + desc;     }      public latlng getcoor() {         return coor;     }      public void setcoor(latlng coor) {         this.coor = coor;     }      public string gettitle() {         return title;     }      public void settitle(string title) {         this.title = title;     }      public string getdesc() {         return desc;     }      public void setdesc(string desc) {         this.desc = desc;     }  } 

here loop getting data. data there. can see log.v(tag,data.tostring());

for (xmldom entry : entries) {                     xmldom lon = entry.tag("longitude");                     xmldom lat = entry.tag("latitude");                     xmldom name = entry.tag("name");                     xmldom desc = entry.tag("description");                      final string firename = name.text();                     final string firedesc = html.fromhtml(desc.text()) + "";                      string geolon = lon.text();                     string geolat = lat.text();                      string coor = lat + "," + lon;                     // log.e("coors: ", coor);                      double lati = double.parsedouble(geolat);                     double lngi = double.parsedouble(geolon);                      location = new latlng(lati, lngi);                      marks = new mapmarkers();                     marks.setcoor(location);                     marks.settitle(firename);                     marks.setdesc(firedesc);                     mrkrs.add(marks);                      (int = 0; < mrkrs.size(); i++) {                         map.addmarker(new markeroptions()                                 .position(location)                                 .title(firename)                                 .snippet("click")                                 .icon(bitmapdescriptorfactory                                         .fromresource(r.drawable.wfmi_icon48)));                         map.setoninfowindowclicklistener(new oninfowindowclicklistener() {                             @override                             public void oninfowindowclick(marker arg0) {                                 //show full description in new activity.                              }                         });                      }                  } 

how can keep description data associated map marker on click can pass data through intent new activity data?

i hope makes sense.... kind of lost. :)

edit:

using mapmarkers class created, map points show correct information when being added map:

marks = new mapmarkers();                     marks.setcoor(location);                     marks.settitle(firename);                     marks.setdesc(firedesc);                      map.addmarker(new markeroptions()                             .position(marks.getcoor())                             .title(marks.gettitle())                             .snippet(marks.getdesc())                             .icon(bitmapdescriptorfactory                                     .fromresource(r.drawable.wfmi_icon48))); 

however, when click on infowindow, last "description" in test message alert window:

map.setoninfowindowclicklistener(new oninfowindowclicklistener() {                             @override                             public void oninfowindowclick(marker arg0) {                                 // show full description in new activity.                                 firedesc(marks.gettitle(), marks.getdesc());                             }                         }); 

so getting description marker issue here. hope clears up.

edit edit:

using firedesc(arg0.gettitle(), arg0.getsnippet()); showing data, need hide snippet?

you can pass whatever details need new description activity, in intent like:

intent = new intent(activity1.this,activity2.class); i.putextra("name", "xxx"); i.putextra("description", "xxxxxx"); i.addflags(intent.flag_activity_clear_top); startactivity(i); 

Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -