how to save capture image in sdcard?

后端 未结 6 2064
旧巷少年郎
旧巷少年郎 2021-01-27 11:19

I want to use default camera and capture image. i want save image in sdcard/photofolder/ and save filename as curenttime format in sdcard/photofolder/ also display capture imag

6条回答
  •  离开以前
    2021-01-27 12:01

    As example given here try this code...

    Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
    File dir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM);
    File output = new File(dir,"camera.png");
    
    cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT,Uri.fromFile(output));
    String path =output.getAbsolutePath();
    startActivityForResult(cameraIntent, TAKE_PHOTO);
    

    path will return location of your image in sdcard

提交回复
热议问题