He cannot even create a folder on the SD card. When the camera takes a photo, it does not respond when I press the OK button. What is wrong with my code?
public static final String MACCHA_PATH = Environment.getExternalStorageDirectory().getPath() + "/Twigit"; public static final String PHOTO_PATH = MACCHA_PATH + "/camera.jpg"; public static boolean takePhoto(Activity activity) { Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); File fileDir = new File(MACCHA_PATH); boolean isSuccessful = true; if (!fileDir.exists()) { isSuccessful = fileDir.mkdir(); } if(!isSuccessful) { return false; } else { File file = new File(PHOTO_PATH); Uri outputFileUri = Uri.fromFile(file); intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri); activity.startActivityForResult(intent, TAKEPHOTO); return true; } }
source share