2013-07-18 66 views
0
private void takeNewPicture() { 

    Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); 

    ContentValues values = new ContentValues(3); 

    values.put(MediaStore.Images.Media.MIME_TYPE, "image/jpeg"); 
    cameraImagePath = getContentResolver().insert( 
    MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);  
    // cameraImagePath= cameraImagePath+"/temp"; 
    takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, cameraImagePath); 
    startActivityForResult(takePictureIntent, 1); 
} 

我使用上面的代碼捕獲和保存image.but但我需要更改文件保存路徑(在SD卡)。保存在SD卡中捕獲的圖像

回答

0

用途:

//SD card "root" directory 
File path = Environment.getExternalStorageDirectory(); 

//SD card directory for pictures 
File path = Environment.getExternalStoragePublicDirectory(
     Environment.DIRECTORY_PICTURES); 
+0

我應該在哪裏把這個代碼 – Dilshi

+0

你好,我WUD更高興,如果你能eloborate的answer.because即時通訊新到Android – Dilshi

+0

我覺得這個答案應該有所幫助: http://stackoverflow.com/questions/1910608/android-action-image-capture-intent – aehs29