예제 #1
0
 @Override
 public void onInfoWindowClick(Marker marker) {
   if (marker.getTitle().equals(getString(R.string.Marker_NotRegistered))) {
     // 未登録のマーカーであれば情報を追加する
     // 地点情報追加画面に遷移
     Intent intent = new Intent(this, AddPlaceActivity.class);
     intent.putExtra("latitude", marker.getPosition().latitude);
     intent.putExtra("longitude", marker.getPosition().longitude);
     startActivityForResult(intent, 123);
   }
   PlaceInfo pInfo = new PlaceInfo();
   pInfo.mMarker = marker;
   if (mPlaceInfoList.contains(pInfo)) {
     // マーカーの詳細情報画面を開く
     Intent intent = new Intent(this, DisplayDetailActivity.class);
     PlaceInfo pClone = mPlaceInfoList.get(mPlaceInfoList.indexOf(pInfo)).getSeralizable();
     intent.putExtra("placeInfo", pClone);
     try {
       startActivity(intent);
     } catch (RuntimeException e) {
       Toast t = Toast.makeText(getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG);
       t.show();
       e.getStackTrace();
     }
   }
 }
예제 #2
0
 @Override
 public void onActivityResult(int requestCode, int resultCode, Intent intent) {
   switch (requestCode) {
     case 123:
       if (resultCode == RESULT_OK) {
         // Delete 'Add Information...' marker, and set registered marker
         mAddMarker.remove();
         mAddMarker = null;
         PlaceInfo pInfo = (PlaceInfo) intent.getSerializableExtra("placeInfo");
         pInfo.SetMarker(mMap, mPlaceInfoList);
         mPlaceInfoList.add(pInfo);
       }
       break;
     default:
       break;
   }
 }