0

I want to store my images in an sdcard subfolder. I have done the following but my images are not getting stored in the subfolder.How can I save my images in the subfolder? My codes are as follows:

 final File wallpaperDirectory = new File("/sdcard/Wallpapertask/");
 wallpaperDirectory.mkdirs();
 myImageView1.setImageBitmap(circleBitmap);
 BitmapDrawable drawable = (BitmapDrawable)myImageView1.getDrawable();
 Bitmap bitmap = drawable.getBitmap();
 File sdCardDirectory = Environment.getExternalStorageDirectory();
 File image = new File(sdCardDirectory, "test2.png");
anu_r
  • 1,602
  • 7
  • 30
  • 61
  • possible duplicate of [Android Camera - Save image into a new folder in SD Card](http://stackoverflow.com/questions/8588838/android-camera-save-image-into-a-new-folder-in-sd-card) – Pankaj Apr 18 '14 at 17:28

1 Answers1

0

How can I save my images in the subfolder?

Your code does not save any images. You can use the compress() method on Bitmap to write a Bitmap to an OutputStream.

Also note that you should not be hardcoding paths, like /sdcard/Wallpapertask, as that path will not work on all devices or for all users.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491