Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <pre><code>private boolean createFolder(String folderName) { // TODO Auto-generated method stub boolean success = true; if(checkforMedia()) { String newFolder = "/OnTheG/"+folderName; String extStorageDirectory = Environment.getExternalStorageDirectory().toString(); File myNewFolder = new File(extStorageDirectory + newFolder); success= myNewFolder.mkdirs(); } else { success=false; } return success; } use this function to create your folder in sdcard. Open the camera using this function to store your clicked image at your folder public void takePhoto1() { if (!android.os.Environment.getExternalStorageState().equals( android.os.Environment.MEDIA_MOUNTED)) { Toast.makeText(Add_View_Images_Activity.this, "Please insert SDcard for capturing photo.", Toast.LENGTH_SHORT).show(); } else { try { photo1=new File(path+"/"+System.currentTimeMillis()+".jpg"); Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photo1)); cameraIntent.putExtra("return-data", true); startActivityForResult(cameraIntent, 4); } catch (Exception e) { Toast.makeText(Add_View_Images_Activity.this, ""+e, Toast.LENGTH_LONG).show(); } } } and If you pick a image from the gallery obtain it's path and then move it to your folder using this function private void moveTheImage(String path) { // TODO Auto-generated method stub // File sd = Environment.getExternalStorageDirectory(); // File data = Environment.getDataDirectory(); String sourceImagePath= path; System.out.println("Source path&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;"+path); String destinationImagePath= fWrapper.path+getTheName(path); File source= new File(sourceImagePath); File destination= new File(destinationImagePath); Log.d("before copying", ""); if (source.exists()) { try { FileChannel src = new FileInputStream(source).getChannel(); FileChannel dst = new FileOutputStream(destination).getChannel(); dst.transferFrom(src, 0, src.size()); src.close(); dst.close(); } catch (Exception e) { // TODO: handle exception } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

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