我打開相機按鈕單擊並拍照並顯示它在imageview中。它在Google Nexus中工作。但它不適用於Samsung Tab和Micromax canvas HD,爲什麼?圖片不顯示在圖像查看
我的按鈕點擊代碼:
CAMERA_PIC_REQUEST = 100;
String path = Environment.getExternalStorageDirectory()
+ "/MySampleApp/image.jpg";
File file = new File(path);
Uri outputFileUri = Uri.fromFile(file);
Intent cameraIntent = new Intent(
android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
startActivityForResult(cameraIntent, CAMERA_PIC_REQUEST);
OnActivityResult代碼:
BitmapFactory.Options options = new BitmapFactory.Options();
options.inSampleSize = 4;
Bitmap bitmap = BitmapFactory.decodeFile(path,
options);
mImageView.setImageBitmap(bitmap);
權限在manifest.xml中
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-feature android:name="android.hardware.camera" />
爲什麼沒有在三星和Micromax的工作代碼?
這是正確的代碼是不是?
任何人請幫助我嗎?
,能得到任何記錄中logcat的同時部署你的應用程序在三星標籤和Micromax帆布高清? –
是的,錯誤從SDCard中讀取文件在android這個錯誤我得到 –
錯誤解決或不?正如你接受了一個答案... –