datos de la intención de la cámara null en onActivityResult (int requestCode, int resultCode, datos de intención) en Samsung S3

Problema: Estoy recibiendo los datos de la intención de la cámara null en onActivityResult(int requestCode, int resultCode, Intent data) en Samsung S3. Pero funciona bien en algunos otros dispositivos. Personalizé mi código para obtener datos y busqué este problema en la web, pero nada resultó útil.

Código:

  protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == TAKE_CAMERA && data != null && data.getData() != null) else if (requestCode == TAKE_CAMERA) { if (resultCode != RESULT_OK) return; Intent intent = new Intent("com.android.camera.action.CROP"); intent.setDataAndType(tempFileUri, "image/*"); intent.putExtra("outputX", 90); intent.putExtra("outputY", 90); intent.putExtra("aspectX", 1); intent.putExtra("aspectY", 1); intent.putExtra("scale", true); intent.putExtra("return-data", true); startActivityForResult(intent, CROP_CAMERA); } else if (requestCode == CROP_CAMERA && data != null) { Bitmap photo = data.getExtras().getParcelable("data"); try { FileOutputStream out = new FileOutputStream(tempFileUri.getPath()); photo.compress(Bitmap.CompressFormat.JPEG, 90, out); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } if (photo != null) { imagePhoto.setImageBitmap(photo); <my code> } } 

Me he enfrentado al mismo problema y tengo trabajo alrededor con abajo de manera que sin duda le ayudará a tr una vez:

Para la Solución me he referido al siguiente enlace para resolver el problema:

Solución de cámara para Samsung Galaxy S3

Escribe el Código Abajo Mientras llamas a la imagen capturada:

 Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(intent, PICK_FROM_CAMERA); 

Y obtener su URI por debajo de la manera dentro OnActivityResult () Método:

 if (resultCode != RESULT_OK) return; switch (requestCode) { case PICK_FROM_CAMERA: Log.i("TAG", "Inside PICK_FROM_CAMERA"); // Describe the columns you'd like to have returned. Selecting from // the Thumbnails location gives you both the Thumbnail Image ID, as // well as the original image ID try { Log.i("TAG", "inside Samsung Phones"); String[] projection = { MediaStore.Images.Thumbnails._ID, // The columns we want MediaStore.Images.Thumbnails.IMAGE_ID, MediaStore.Images.Thumbnails.KIND, MediaStore.Images.Thumbnails.DATA }; String selection = MediaStore.Images.Thumbnails.KIND + "=" + // Select // only // mini's MediaStore.Images.Thumbnails.MINI_KIND; String sort = MediaStore.Images.Thumbnails._ID + " DESC"; // At the moment, this is a bit of a hack, as I'm returning ALL // images, and just taking the latest one. There is a better way // to // narrow this down I think with a WHERE clause which is // currently // the selection variable Cursor myCursor = this.managedQuery( MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI, projection, selection, null, sort); long imageId = 0l; long thumbnailImageId = 0l; String thumbnailPath = ""; try { myCursor.moveToFirst(); imageId = myCursor .getLong(myCursor .getColumnIndexOrThrow(MediaStore.Images.Thumbnails.IMAGE_ID)); thumbnailImageId = myCursor .getLong(myCursor .getColumnIndexOrThrow(MediaStore.Images.Thumbnails._ID)); thumbnailPath = myCursor .getString(myCursor .getColumnIndexOrThrow(MediaStore.Images.Thumbnails.DATA)); } finally { // myCursor.close(); } // Create new Cursor to obtain the file Path for the large image String[] largeFileProjection = { MediaStore.Images.ImageColumns._ID, MediaStore.Images.ImageColumns.DATA }; String largeFileSort = MediaStore.Images.ImageColumns._ID + " DESC"; myCursor = this.managedQuery( MediaStore.Images.Media.EXTERNAL_CONTENT_URI, largeFileProjection, null, null, largeFileSort); String largeImagePath = ""; try { myCursor.moveToFirst(); // This will actually give yo uthe file path location of the // image. largeImagePath = myCursor .getString(myCursor .getColumnIndexOrThrow(MediaStore.Images.ImageColumns.DATA)); mImageCaptureUri = Uri.fromFile(new File( largeImagePath)); } finally { // myCursor.close(); } // These are the two URI's you'll be interested in. They give // you a // handle to the actual images Uri uriLargeImage = Uri.withAppendedPath( MediaStore.Images.Media.EXTERNAL_CONTENT_URI, String.valueOf(imageId)); Uri uriThumbnailImage = Uri.withAppendedPath( MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI, String.valueOf(thumbnailImageId)); // I've left out the remaining code, as all I do is assign the // URI's // to my own objects anyways... } catch (Exception e) { Log.i("TAG", "inside catch Samsung Phones exception " + e.toString()); } try { Log.i("TAG", "URI Normal:" + mImageCaptureUri.getPath()); } catch (Exception e) { Log.i("TAG", "Excfeption inside Normal URI :" + e.toString()); } //doCrop(); break; 

si está proporcionando MediaStore.EXTRA_OUTPUT, entonces la intención es nula, pero tendrá la foto en el archivo que proporcionó (Uri.fromFile (f)).

Espero que por debajo de enlace dar la solución para you.It trabajo para mí.

http://mylearnandroid.blogspot.in/2014/02/multiple-choose-custom-gallery.html

He solucionado este problema diciendo a la actividad de la cámara para guardar la imagen en la tarjeta SD:

 tempImageNameUri = "some temporary name"; i = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); i.putExtra(MediaStore.EXTRA_OUTPUT,tempImageNameUri); i.putExtra("return-data", true); startActivityForResult(i,SOME_CONSTANT); 

y cuando terminó la actividad llamada, en onActivityResult tomar el elemento de la tarjeta SD de la ruta temporal y utilizarlo.

Usted podría tener la solución a su pregunta, pero esto ayudaría a alguien. A continuación se muestra el enlace de blog creado por Commonsware que trata sobre el cultivo de la imagen después de la foto se toma. En el que dijo que con la acción com.android.camera.action.CROP podría no funcionar perfecto en todos los diferentes tipos de dispositivos.

Aquí está el enlace

FlipAndroid es un fan de Google para Android, Todo sobre Android Phones, Android Wear, Android Dev y Aplicaciones para Android Aplicaciones.