2011-09-10 106 views
0

我使用下面的代碼來捕獲圖像。如何在Android中捕捉圖像?

Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); 
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT,outputFileUri); 
startActivityForResult(cameraIntent,CAPT_PHOTO); 

它的工作的優良的的HTC Legend,HTC渴望,三星galaxy和三星Galaxy Tab。
但在LG Optimus打開相機並通過它自己的名稱和uri保存圖像文件。如何解決這個問題?

回答

1

您可以嘗試添加額外的附加:MediaStore.EXTRA_MEDIA_TITLE您可以在其中定義圖像的標題。希望這可以幫助!

+0

您的意思是代替這一行「cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT,outputFileUri);」我應該使用這個「cameraIntent.putExtra(MediaStore.EXTRA_MEDIA_TITLE,outputFileUri);」 –

0
choosePhotoImage = Environment.getExternalStorageDirectory()+ "/make_machine_example" + (counter++) + ".jpg"; 
         File file = new File(choosePhotoImage); 
         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);