0

如何通过单击标记信息窗口将动态数据(如用户代码)从一个活动传递到另一个活动

for(int pin=0; pin<userData.size(); pin++)
          {
              BitmapDescriptor icon;
              if(  userData.get(pin).userloginSTS==1)
              {
                 icon = BitmapDescriptorFactory.fromResource(R.drawable.greenpin);
              }
              else
              {
                  icon = BitmapDescriptorFactory.fromResource(R.drawable.redpin);
              }

              LatLng pinLocation = new LatLng(userData.get(pin).userlat,userData.get(pin).userlon);
              Marker storeMarker = mMap.addMarker(new MarkerOptions()
              .position(pinLocation )
              .icon(icon)
              .title(userData.get(pin).userName)
              .snippet(GetAddress(userData.get(pin).userlat, userData.get(pin).userlon))
              );
              storeMarker.showInfoWindow();

              final int usercod =userData.get(postion).userCode;
              mMap.setOnInfoWindowClickListener(new OnInfoWindowClickListener() {                          
                  @Override

                  public void onInfoWindowClick(Marker arg0) {




                      Intent intent = new Intent(DataClass.this,test.class);
                      intent.putExtra("usercod", usercod);
                      startActivity(intent); 
                  }
              });

          }

在点击信息寡妇时,每次任何解决方案都会发送最后一个用户价值

4

1 回答 1

2
  googleMap.setOnInfoWindowClickListener(new OnInfoWindowClickListener() {                          
                        @Override

                        public void onInfoWindowClick(Marker arg0) {

                            Bundle bundle = new Bundle();
                            bundle.putString("mId",Data);
                            Intent intent = new Intent();
                            intent.setClass(ctx, YourClass.class);
                            intent.putExtra("mDetails", bundle);
                            startActivity(intent);
                        }
                    });
于 2013-11-14T08:01:31.797 回答