Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>please check this</p> <p>Case 1:</p> <pre><code>Uri newImageUri = null; File path = new File(Environment.getExternalStorageDirectory().getPath() + "/Images/"); path.mkdirs(); boolean setWritable = false; setWritable = path.setWritable(true, false); File file = new File(path, "Image_Story_" + System.currentTimeMillis() + ".jpg"); newImageUri = Uri.fromFile(file); Log.i("MainActivity", "new image uri to string is " + newImageUri.toString()); Log.i("MainActivity", "new image path is " + newImageUri.getPath()); Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, newImageUri); startActivityForResult(intent, REQUEST_CODE_CAPTURE_IMAGE); </code></pre> <p>Case 2: </p> <pre><code>String fileName = "" + System.currentTimeMillis() + ".jpg"; ContentValues values = new ContentValues(); values.put(MediaStore.Images.Media.TITLE, fileName); values.put(MediaStore.Images.Media.DESCRIPTION, "Image capture by camera"); values.put(MediaStore.Images.Media.MIME_TYPE, "image/jpeg"); Uri imageUri = getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values); Log.i("MainActivity", "new image uri to string is " + imageUri.toString()); Log.i("MainActivity", "new image path is " + imageUri.getPath()); Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri); intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1); startActivityForResult(intent, REQUEST_CODE_CAPTURE_IMAGE); </code></pre> <p>I am able to save images through camera on nexus s in both of the above cases In case 1: a.Image is stored in custom folder. b. If the “System.currentTimeMillis()” is changed to (“new Date().toString()”) image is not saved and camera does not return to my activity. (Probably because “System.currentTimeMillis” has no spaces and “new Date().toString()” might be having some special characters and spaces) In case 2: a. Image is stored in camera folder</p> <p>Thanks to all</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload