在标记点击上传递字符串

时间:2014-11-08 17:28:04

标签: android eclipse google-maps-markers android-json

我正在尝试传递字符串来自json数组我试过这段代码

     mMap.setOnMarkerClickListener(new OnMarkerClickListener() {
         public void onInfoWindowClick(Marker marker) {
         Toast.makeText(Newtab.this,"MARKER clicked", Toast.LENGTH_SHORT).show();
     }

    @Override
    public boolean onMarkerClick(Marker arg0) {

         Intent intent = new Intent(Newtab.this, SingleItemView.class);
         try {
             intent.putExtra("DESCRIPTION",obj.getString("DESCRIPTION"));
         } catch (JSONException e) {
             // TODO Auto-generated catch block
             e.printStackTrace();
         }

         // Start SingleItemView Class
         intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);

         startActivity(intent);
         return false;
    }
});

但它只传递数组中的最后一个String。

如何将与特定标记相关的字符串传递给另一个活动?

0 个答案:

没有答案