1

저는 Android가 처음이며 Android 앱에서 작업하고 있습니다. 이 앱에는 활동 편집과지도 활동이라는 두 가지 활동이 있습니다.두 액티비티간에 카메라 이미지로 인 텐트를 처리하고 Google Maps API에서 해당 이미지를 마커에 전달하면 작동하지 않습니다.

편집 활동에서 사용자는 데이터를 입력하고 잘 작동하는 Android 전화에서 사진을 찍을 수 있습니다. 다른 활동은 맵 활동이며지도의 마커가 표시됩니다.

지도의 아이콘에는 잘 작동하는 비트 맵이 포함되어 있습니다. 작동하지 않는 부분은 비트 맵 그래픽 대신 마커에 카메라 그림을 배치하는 부분입니다.

카메라의 이미지가 작동하는 편집 활동에 대한 이미지보기로 표시됩니다.

작동하지 않는 부분은 카메라의 의도를 다른 활동으로 전달하고 의도 내용을 마커에 배치하는 것입니다.

Here's 편집 활동 (많은 코드가 주석) :

import android.app.Activity; 
import android.content.ContentValues; 
import android.content.Intent; 
import android.database.sqlite.SQLiteDatabase; 
import android.graphics.Bitmap; 
import android.graphics.BitmapFactory; 
import android.net.Uri; 
import android.os.Bundle; 
import android.os.Environment; 
import android.provider.MediaStore; 
import android.support.v4.content.FileProvider; 
import android.util.Log; 
import android.view.View; 
import android.widget.Button; 
import android.widget.EditText; 
import android.widget.ImageView; 

import com.google.android.gms.maps.CameraUpdateFactory; 
import com.google.android.gms.maps.GoogleMap; 
import com.google.android.gms.maps.model.BitmapDescriptorFactory; 
import com.google.android.gms.maps.model.LatLng; 
import com.google.android.gms.maps.model.MarkerOptions; 
import java.io.File; 
import java.io.IOException; 
import java.text.SimpleDateFormat; 
import java.util.Date; 

import static android.R.attr.data; 
import static android.R.attr.id; 
import static android.content.ContentValues.TAG; 
import static android.provider.MediaStore.ACTION_IMAGE_CAPTURE; 



public class EditActivity extends Activity { 


    public static int count = 0; 
    static final int REQUEST_TAKE_PHOTO = 1; 
    private static final String KEY_MARKER_ID = "id"; 
    private static final String KEY_MARKER_TITLE = "title"; 
    private static final String KEY_MARKER_DATE = "date"; 
    private static final String KEY_MARKER_LOC = "location"; 
    private static final String KEY_MARKER_LAT = "latlng"; 
    private static final String KEY_MARKER_NAME = "name"; 
    private static final String KEY_MARKER_PIC = "picture"; 
    private static final int CAMERA_REQUEST = 1888; 
    private ImageView imageView; 


    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.editactivity); 
     PostsDatabaseHelper helper = PostsDatabaseHelper.getInstance(this); 
     helper.getReadableDatabase(); 
     this.imageView = (ImageView)this.findViewById(R.id.imageView1); 
     Button photoButton = (Button) this.findViewById(R.id.btnCapture); 
     photoButton.setOnClickListener(new View.OnClickListener() { 

      @Override 
      public void onClick(View v) { 
       Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); 
       startActivityForResult(cameraIntent, CAMERA_REQUEST); 
      } 
     }); 

     final LatLng latlng = getIntent().getParcelableExtra("location"); 
     //final MarkerImage markerImage = getIntent().getParcelableExtra("data"); 
     final EditText title = (EditText) findViewById(R.id.title); 
     final EditText date = (EditText) findViewById(R.id.date); 
     final EditText location = (EditText) findViewById(R.id.location); 
     final ImageView image = (ImageView) findViewById(R.id.imageView1); 
     final EditText name = (EditText) findViewById(R.id.name); 
     Button button = (Button) findViewById(R.id.save); 
     final Button camerabutton = (Button) findViewById(R.id.btnCapture); 
     final Intent getCameraImage = new Intent(ACTION_IMAGE_CAPTURE); 


     button.setOnClickListener(new View.OnClickListener() { 
      @Override 
      public void onClick(final View view) { 
       Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.icon); 
       MarkerOptions marker = new MarkerOptions().position(latlng) 
         .icon(BitmapDescriptorFactory.fromBitmap(bmp) 
         ); 
       if (title.getText() != null) { 
        marker.title(title.getText().toString()); 
       } 
       if (date.getText() != null) { 
        marker.getPosition(); 
        Log.d("String Value of Marker:", String.valueOf(marker)); 
       } 

       Intent resultIntent = new Intent(); 
       resultIntent.putExtra("marker", marker); 
       resultIntent.putExtra("picture", getCameraImage); 
       Log.d("Längen-und Breitengrad:", String.valueOf(marker)); 
       setResult(Activity.RESULT_OK, resultIntent); 
       finish(); 
      } 

     }); 


     // Here, we are making a folder named picFolder to store 
     // pics taken by the camera using this application. 
     //final String dir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES) + "/picFolder/"; 
     //File newdir = new File(dir); 
     //newdir.mkdirs(); 

     //final Intent cameraIntent = new Intent(ACTION_IMAGE_CAPTURE); 
     // Ensure that there's a camera activity to handle the intent 
     /*if (getCameraImage.resolveActivity(getPackageManager()) != null) { 
      // Create the File where the photo should go 
      SQLiteDatabase db = helper.getWritableDatabase(); 


      db.beginTransaction(); 
      try { 
       // The user might already exist in the database (i.e. the same user created multiple posts). 
       //long markerId = addOrUpdateMarker(marker.user); 

       ContentValues values = new ContentValues(); 

       values.put(KEY_MARKER_ID, id); 
       values.put(KEY_MARKER_TITLE, String.valueOf(title)); 
       values.put(KEY_MARKER_NAME, String.valueOf(name)); 
       values.put(KEY_MARKER_LOC, String.valueOf(location)); 
       values.put(KEY_MARKER_DATE, String.valueOf(date)); 
       // Notice how we haven't specified the primary key. SQLite auto increments the primary key column. 
       db.insertOrThrow(TABLE_MARKERS, null, values); 
       db.setTransactionSuccessful(); 
      } catch (Exception e) { 
       Log.d(TAG, "Error while trying to add post to database"); 
      } finally { 
       db.endTransaction(); 
      } 

      /*File photoFile = null; 
      try { 
       photoFile = createImageFile(); 
      } catch (IOException ex) { 
       // Error occurred while creating the File 
      } 
      // Continue only if the File was successfully created 
      if (photoFile != null) { 
       Uri photoURI = FileProvider.getUriForFile(this, 
         "com.example.android.fileprovider", 
         photoFile); 
       cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI); 
       startActivityForResult(cameraIntent, REQUEST_TAKE_PHOTO); 
      } 
     } 
     /*capture.setOnClickListener(new View.OnClickListener() { 
      public void onClick(View v) { 

       // Here, the counter will be incremented each time, and the 
       // picture taken by camera will be stored as 1.jpg,2.jpg 
       // and likewise. 

       //count++; 
       //String file = dir+count+".jpg"; 
       //File newfile = new File(file); 
       //try { 
       // newfile.createNewFile(); 
       //} 
       // catch (IOException e) 
       // { 
       // } 

       //Uri outputFileUri = Uri.fromFile(newfile); 

       //cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri); 
       startActivityForResult(cameraIntent, REQUEST_TAKE_PHOTO); 
      } 
     }); 
    } 

    String mCurrentPhotoPath; 

    private File createImageFile() throws IOException { 
     // Create an image file name 
     String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()); 
     String imageFileName = "JPEG_" + timeStamp + "_"; 
     File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES); 
     File image = File.createTempFile(
       imageFileName, /* prefix */ 
       // ".jpg",   /* suffix */ 
       // storageDir  /* directory */ 
     //); 

     // Save a file: path for use with ACTION_VIEW intents 
     //mCurrentPhotoPath = image.getAbsolutePath(); 
     //return image; 
    } 

     /*@Override 
     protected void onActivityResult(int requestCode, int resultCode, Intent data) { 
      super.onActivityResult(requestCode, resultCode, data); 
      if (requestCode == REQUEST_TAKE_PHOTO && resultCode == RESULT_OK) { 
        Bundle extras = data.getExtras(); 
        Bitmap imageBitmap = (Bitmap) extras.get("data"); 
        Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.icon); 



       } 
      } 

     /*if (requestCode == TAKE_PHOTO_CODE && resultCode == RESULT_OK) { 
      Log.d("CameraDemo", "Pic saved"); 

     }*/ 

    protected void onActivityResult(int requestCode, int resultCode, Intent data) { 
     if (requestCode == CAMERA_REQUEST && resultCode == Activity.RESULT_OK) { 
      Bitmap photo = (Bitmap) data.getExtras().get("data"); 
      imageView.setImageBitmap(photo); 
     } 
    } 


} 

Here's지도 ​​활동 :

import android.app.Activity; 
import android.content.ContentValues; 
import android.content.Context; 
import android.content.Intent; 
import android.database.sqlite.SQLiteDatabase; 
import android.graphics.Bitmap; 
import android.graphics.BitmapFactory; 
import android.os.Bundle; 
import android.support.v4.app.FragmentActivity; 
import android.util.Log; 
import android.view.View; 

import gmbh.webagenten.recycling.PostsDatabaseHelper; 
import gmbh.webagenten.recycling.SQLiteSampleActivity; 

import com.google.android.gms.maps.CameraUpdateFactory; 
import com.google.android.gms.maps.GoogleMap; 
import com.google.android.gms.maps.OnMapReadyCallback; 
import com.google.android.gms.maps.SupportMapFragment; 
import com.google.android.gms.maps.model.BitmapDescriptorFactory; 
import com.google.android.gms.maps.model.LatLng; 
import com.google.android.gms.maps.model.MarkerOptions; 

import static android.content.ContentValues.TAG; 
import static gmbh.webagenten.recycling.R.attr.title; 


public class MapsActivity extends FragmentActivity implements OnMapReadyCallback { 
    private GoogleMap mMap; 
    private static final int EDIT_REQUEST = 1; 


    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     setTheme(R.style.AppTheme); 
     super.onCreate(savedInstanceState); 
     // Get singleton instance of database 

     //PostsDatabaseHelper databaseHelper = PostsDatabaseHelper.getInstance((Context) this); 

     setContentView(R.layout.activity_maps); 
     SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() 
       .findFragmentById(R.id.map); 
     mapFragment.getMapAsync(this); 
    } 



    @Override 
    public void onMapReady(GoogleMap map) { 

     Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.id.imageView1); 
     this.mMap = map; 
     try { 
      mMap.setMyLocationEnabled(true); 
     } catch (SecurityException e) { 
      LatLng hamburg = new LatLng(53.551085, 9.993682); 
      mMap.addMarker(new MarkerOptions().position(hamburg).title("Marker in Hamburg") 
       .icon(BitmapDescriptorFactory.fromBitmap(bmp))); 
      mMap.moveCamera(CameraUpdateFactory.newLatLng(hamburg)); 
      //PostsDatabaseHelper helper = PostsDatabaseHelper.getInstance(this); 
      //helper.getReadableDatabase(); 
      //Log.d(TAG, "Database in use"); 
     } 

     mMap.setOnMapClickListener(new GoogleMap.OnMapClickListener() { 
      @Override 
      public void onMapClick(final LatLng latLng) { 

       Intent edit = new Intent(MapsActivity.this, EditActivity.class); 
       edit.putExtra("location", latLng); 
       Log.d("Längen-und Breitengrad:", String.valueOf(latLng)); 

       MapsActivity.this.startActivityForResult(edit, EDIT_REQUEST); 
      } 
     }); 
    } 

    @Override 
    public void onActivityResult(int requestCode, int resultCode, Intent data) { 
     super.onActivityResult(requestCode, resultCode, data); 

     switch(requestCode) { 
      case (EDIT_REQUEST) : { 
       if (resultCode == Activity.RESULT_OK) { 
        Bundle bundle = data.getExtras(); 
        MarkerOptions markerOptions = data.getParcelableExtra("marker"); 
        MarkerOptions markerImage = data.getParcelableExtra("data"); 
        mMap.addMarker(markerOptions); 
        //mMap.addMarker(markerImage); 
       } 
       break; 
      } 
     } 
    } 
} 

    /** 
    * Manipulates the map once available. 
    * This callback is triggered when the map is ready to be used. 
    * This is where we can add markers or lines, add listeners or move the camera. In this case, 
    * we just add a marker near Sydney, Australia. 
    * If Google Play services is not installed on the device, the user will be prompted to install 
    * it inside the SupportMapFragment. This method will only be triggered once the user has 
    * installed Google Play services and returned to the app. 
    */ 


/* 

    @Override 
    public void onMapReady(GoogleMap googleMap) { 
     mMap = googleMap; 
     try { 
      mMap.setMyLocationEnabled(true); 
     } catch (SecurityException e) { 
      LatLng hamburg = new LatLng(53.551085, 9.993682); 
      mMap.addMarker(new MarkerOptions().position(hamburg).title("Marker in Hamburg")); 
      mMap.moveCamera(CameraUpdateFactory.newLatLng(hamburg)); 
      mMap.setOnMapClickListener(this); 
     } 
     mMap.setOnMapClickListener(new GoogleMap.OnMapClickListener() { 
      @Override 
      public void onMapClick(final LatLng latLng) { 
       Intent edit = new Intent(MapsActivity.this, EditActivity.class); 
       edit.putExtra("location", latLng); 
       MapsActivity.this.startActivityForResult(edit, EDIT_REQUEST); 
      } 
     }); 


    } 

*/ 

XML 파일 :

<?xml version="1.0" encoding="utf-8"?> 
<selector xmlns:android="http://schemas.android.com/apk/res/android"> 
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:orientation="vertical" 
     android:layout_width="50dp" 
     android:layout_height="50dp" 
     android:background="#222" 
     android:id="@+id/llMarker"> 

     <ImageView 
      android:id="@+id/ivMarker" 
      android:layout_marginTop="5dp" 
      android:layout_width="40dp" 
      android:layout_height="40dp" /> 
     <item> 
      <ImageView android:id="@+id/imageView1" android:layout_height="wrap_content" android:layout_width="wrap_content"></ImageView> 
     </item> 

    </LinearLayout> 
</selector> 

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical"> 

    <EditText 
     android:id="@+id/title" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:hint="Title" 
     android:inputType="text" /> 

    <EditText 
     android:id="@+id/date" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:hint="Date" 
     android:inputType="date" /> 

    <EditText 
     android:id="@+id/location" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:hint="Location" 
     android:inputType="text" /> 

    <EditText 
     android:id="@+id/name" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:hint="Name" 
     android:inputType="text" /> 

    <Button 
     android:id="@+id/btnCapture" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="Camera" /> 

    <Button 
     android:id="@+id/save" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="Save"/> 

    <ImageView android:id="@+id/imageView1" android:layout_height="wrap_content" android:layout_width="wrap_content"></ImageView> 

안드로이드에, 나는이 문제에 더 오래 머물러있다. 도움이나 힌트를 주시면 감사하겠습니다.

답변

0

문제점을 이해합니다. 내가 실수 한 점은 비트 맵을 다음 액티비티로 가져올 수 없다는 것입니다. 편집 활동에서 이미지 뷰로 데이터를 설정했고 맵 액티비티를 열면 해당 데이터가 손실됩니다.

당신은해야만합니다 : 1. 비트 맵을 편집 활동 에서지도 활동으로 전달하십시오. 2. 비트 맵을 맵 활동으로 가져온 다음 비트 맵을 맵에 표시하십시오. 여기

import android.app.Activity; 
import android.content.ContentValues; 
import android.content.Intent; 
import android.database.sqlite.SQLiteDatabase; 
import android.graphics.Bitmap; 
import android.graphics.BitmapFactory; 
import android.net.Uri; 
import android.os.Bundle; 
import android.os.Environment; 
import android.provider.MediaStore; 
import android.support.v4.content.FileProvider; 
import android.util.Log; 
import android.view.View; 
import android.widget.Button; 
import android.widget.EditText; 
import android.widget.ImageView; 

import com.google.android.gms.maps.CameraUpdateFactory; 
import com.google.android.gms.maps.GoogleMap; 
import com.google.android.gms.maps.model.BitmapDescriptorFactory; 
import com.google.android.gms.maps.model.LatLng; 
import com.google.android.gms.maps.model.MarkerOptions; 
import java.io.File; 
import java.io.IOException; 
import java.text.SimpleDateFormat; 
import java.util.Date; 

import static android.R.attr.data; 
import static android.R.attr.id; 
import static android.content.ContentValues.TAG; 
import static android.provider.MediaStore.ACTION_IMAGE_CAPTURE; 



public class EditActivity extends Activity { 


    public static int count = 0; 
    static final int REQUEST_TAKE_PHOTO = 1; 
    private static final String KEY_MARKER_ID = "id"; 
    private static final String KEY_MARKER_TITLE = "title"; 
    private static final String KEY_MARKER_DATE = "date"; 
    private static final String KEY_MARKER_LOC = "location"; 
    private static final String KEY_MARKER_LAT = "latlng"; 
    private static final String KEY_MARKER_NAME = "name"; 
    private static final String KEY_MARKER_PIC = "picture"; 
    private static final int CAMERA_REQUEST = 1888; 
    private ImageView imageView; 
    Bitmap photo; 

    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.editactivity); 
     PostsDatabaseHelper helper = PostsDatabaseHelper.getInstance(this); 
     helper.getReadableDatabase(); 
     this.imageView = (ImageView)this.findViewById(R.id.imageView1); 
     Button photoButton = (Button) this.findViewById(R.id.btnCapture); 
     photoButton.setOnClickListener(new View.OnClickListener() { 

      @Override 
      public void onClick(View v) { 
       Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); 
       startActivityForResult(cameraIntent, CAMERA_REQUEST); 
      } 
     }); 

     final LatLng latlng = getIntent().getParcelableExtra("location"); 
     //final MarkerImage markerImage = getIntent().getParcelableExtra("data"); 
     final EditText title = (EditText) findViewById(R.id.title); 
     final EditText date = (EditText) findViewById(R.id.date); 
     final EditText location = (EditText) findViewById(R.id.location); 
     final ImageView image = (ImageView) findViewById(R.id.imageView1); 
     final EditText name = (EditText) findViewById(R.id.name); 
     Button button = (Button) findViewById(R.id.save); 
     final Button camerabutton = (Button) findViewById(R.id.btnCapture); 
     final Intent getCameraImage = new Intent(ACTION_IMAGE_CAPTURE); 


     button.setOnClickListener(new View.OnClickListener() { 
      @Override 
      public void onClick(final View view) { 
       Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.icon); 
       MarkerOptions marker = new MarkerOptions().position(latlng) 
         .icon(BitmapDescriptorFactory.fromBitmap(bmp) 
         ); 
       if (title.getText() != null) { 
        marker.title(title.getText().toString()); 
       } 
       if (date.getText() != null) { 
        marker.getPosition(); 
        Log.d("String Value of Marker:", String.valueOf(marker)); 
       } 

       Intent resultIntent = new Intent(); 
       resultIntent.putExtra("marker", marker); 
       resultIntent.putExtra("picture", getCameraImage); 
       intent.putExtra("BitmapImage", photo);   // passing the bitmap to the next activity . and retrieve it to the next activity 
       Log.d("Längen-und Breitengrad:", String.valueOf(marker)); 
       setResult(Activity.RESULT_OK, resultIntent); 
       finish(); 
      } 

     }); 



    protected void onActivityResult(int requestCode, int resultCode, Intent data) { 
     if (requestCode == CAMERA_REQUEST && resultCode == Activity.RESULT_OK) { 
      `photo = (Bitmap) data.getExtras().get("data"); 
      imageView.setImageBitmap(photo); 
     } 
    } 


} 

지도 활동 여기

import android.app.Activity; 
import android.content.ContentValues; 
import android.content.Context; 
import android.content.Intent; 
import android.database.sqlite.SQLiteDatabase; 
import android.graphics.Bitmap; 
import android.graphics.BitmapFactory; 
import android.os.Bundle; 
import android.support.v4.app.FragmentActivity; 
import android.util.Log; 
import android.view.View; 

import gmbh.webagenten.recycling.PostsDatabaseHelper; 
import gmbh.webagenten.recycling.SQLiteSampleActivity; 

import com.google.android.gms.maps.CameraUpdateFactory; 
import com.google.android.gms.maps.GoogleMap; 
import com.google.android.gms.maps.OnMapReadyCallback; 
import com.google.android.gms.maps.SupportMapFragment; 
import com.google.android.gms.maps.model.BitmapDescriptorFactory; 
import com.google.android.gms.maps.model.LatLng; 
import com.google.android.gms.maps.model.MarkerOptions; 

import static android.content.ContentValues.TAG; 
import static gmbh.webagenten.recycling.R.attr.title; 


public class MapsActivity extends FragmentActivity implements OnMapReadyCallback { 
    private GoogleMap mMap; 
    private static final int EDIT_REQUEST = 1; 
    Bitmap bmp; 


    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     setTheme(R.style.AppTheme); 
     super.onCreate(savedInstanceState); 
     // Get singleton instance of database 

     Intent intent = getIntent(); 
     bmp = (Bitmap) intent.getParcelableExtra("BitmapImage");  // getting the bitmap data from the edit activity. 

     //PostsDatabaseHelper databaseHelper = PostsDatabaseHelper.getInstance((Context) this); 

     setContentView(R.layout.activity_maps); 
     SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() 
       .findFragmentById(R.id.map); 
     mapFragment.getMapAsync(this); 
    } 



    @Override 
    public void onMapReady(GoogleMap map) { 

     //Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.id.imageView1); 
     this.mMap = map; 
     try { 
      mMap.setMyLocationEnabled(true); 
     } catch (SecurityException e) { 
      LatLng hamburg = new LatLng(53.551085, 9.993682); 
      mMap.addMarker(new MarkerOptions().position(hamburg).title("Marker in Hamburg") 
       .icon(BitmapDescriptorFactory.fromBitmap(bmp))); 
      mMap.moveCamera(CameraUpdateFactory.newLatLng(hamburg)); 
      //PostsDatabaseHelper helper = PostsDatabaseHelper.getInstance(this); 
      //helper.getReadableDatabase(); 
      //Log.d(TAG, "Database in use"); 
     } 

     mMap.setOnMapClickListener(new GoogleMap.OnMapClickListener() { 
      @Override 
      public void onMapClick(final LatLng latLng) { 

       Intent edit = new Intent(MapsActivity.this, EditActivity.class); 
       edit.putExtra("location", latLng); 
       Log.d("Längen-und Breitengrad:", String.valueOf(latLng)); 

       MapsActivity.this.startActivityForResult(edit, EDIT_REQUEST); 
      } 
     }); 
    } 

    @Override 
    public void onActivityResult(int requestCode, int resultCode, Intent data) { 
     super.onActivityResult(requestCode, resultCode, data); 

     switch(requestCode) { 
      case (EDIT_REQUEST) : { 
       if (resultCode == Activity.RESULT_OK) { 
        Bundle bundle = data.getExtras(); 
        MarkerOptions markerOptions = data.getParcelableExtra("marker"); 
        MarkerOptions markerImage = data.getParcelableExtra("data"); 
        mMap.addMarker(markerOptions); 
        //mMap.addMarker(markerImage); 
       } 
       break; 
      } 
     } 
    } 
} 

업데이트 된 코드는, 그것을 확인 .Kindly 도움을 알려 주시기 바랍니다 있습니다.

+0

안녕하세요 @rajendra, 노력해 주셔서 감사합니다. 그러나 코드는 여전히 동일한 결과를 생성하므로 원하는대로 작동하지 않습니다. Bitmap bmp = BitmapFactory.decodeResource (getResources(), R.drawable.icon) 카메라 이미지로 대체되어야하며 작동하지 않습니다. 더 이상의 도움이나 힌트를 주시면 감사하겠습니다! – user8623502

+0

안녕하세요, 비트 맵을 디코딩하지 말고 편집 활동에서 의도를 보내려면 가져와야합니다. 의도 intent = getIntent(); bmp = (비트 맵) intent.getParcelableExtra ("BitmapImage"); – rajendra

+0

intent.putExtra ("BitmapImage", photo); \t \t \t // 비트 맵을 다음 활동으로 전달합니다. 다음 활동으로 되 찾으십시오. – rajendra