Android谷歌地图标记的多个片段

时间:2014-10-27 05:24:08

标签: android google-maps

我的标记中可以有多个片段吗?我需要使用它的其他信息。这是我目前的代码。我想在这里添加电话号码信息并将数据设置为意图。

  //Adding marker on the GoogleMaps
  private void addMarker(LatLng latlng,final String location2, final String address2) {
  MarkerOptions markerOptions = new MarkerOptions();
  markerOptions.position(latlng);
  markerOptions.title(location2);
  markerOptions.icon(BitmapDescriptorFactory.fromResource(Store));
  markerOptions.snippet(address2);
  map.addMarker(markerOptions);

  map.setOnInfoWindowClickListener(new OnInfoWindowClickListener() {
      @Override
      public void onInfoWindowClick(Marker marker) {

        Toast.makeText(MainActivity.this, marker.getTitle(),1000).show();// display toast

        //Create Intent object
        Intent openNewActivity = new Intent(getApplicationContext(),Shop_Details.class);

        //Directly set data in intent object
        openNewActivity.putExtra("title", marker.getTitle());
        openNewActivity.putExtra("address", marker.getSnippet());

        startActivity(openNewActivity);

      }
  });

}

0 个答案:

没有答案