I want to capture an image from camera and save to my own path, not DCIM folder.
I have tried almost all answers of Stackoverflow, but I did not get any solution yet.
Error:
12-26 19:49:39.520: W/System.err(25861): java.lang.NullPointerException 12-26 19:49:39.550: W/System.err(25861): at java.io.File.fixSlashes(File.java:185) 12-26 19:49:39.550: W/System.err(25861): at java.io.File.(File.java:134)
public String finalimagepath = Environment.getExternalStorageDirectory() + "";
private static final int CAMERA_CAPTURE_IMAGE_REQUEST_CODE = 100;
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
String randomvalue = String.valueOf(System.currentTimeMillis()) + ".png";
File f = new File(finalimagepath, randomvalue);
finalimagefullpath = finalimagepath + "/" + randomvalue;
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(f));
startActivityForResult(intent, CAMERA_CAPTURE_IMAGE_REQUEST_CODE);