일부 기기 및 Android 기기에서 카메라로 사진을 찍을 때 문제가 있습니다. 예를 들어, 내 Xperia U v4.0.3에서 내 코드는 잘 작동하지만 다른 xperia U v2.3.3에서는 작동하지 않습니다 ...OutOfMemeryError 일부 기기에서 사진 인트로 찍기
이 오류에 대해 많이 읽었지만 해결할 수 없었습니다. ..
사진을 촬영하고 그것을 보여 내 코드 :
나는 내가 무엇을 할 수 있는지 모르겠다 ... 누군가가 나를 도울 수 있기를 바랍니다public void callCamera(){
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
File photo = new File(Environment.getExternalStorageDirectory(), "Pic.jpg");
intent.putExtra(MediaStore.EXTRA_OUTPUT,
Uri.fromFile(photo));
imageUri = Uri.fromFile(photo);
startActivityForResult(intent, SELECT_CAMERA);
}
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == SELECT_CAMERA) {
Uri selectedImage = imageUri;
getContentResolver().notifyChange(selectedImage, null);
ContentResolver cr = getContentResolver();
try {
imageSelected = android.provider.MediaStore.Images.Media
.getBitmap(cr, selectedImage);
// I tried to read the image created for the camera in the Sd
//But I've got the same error...
//imageSelected = Utils.readImageSD(this, selectedImage.getPath());
imageSelected = Utils.rotateImage(Utils.scaleBitmap(imageSelected, 160, 160));
ivImageLoad.setImageBitmap(imageSelected);
} catch (Exception e) {
Utils.showToast(getApplicationContext(), R.string.errorLoad);
Log.e("Camera", e.toString());
}
}
}
....
감사합니다 미리.
감사합니다.
완벽하게 여기 – RajeshVijayakumar