You can add this code to onActivityResult. This will save your image in a folder named "YourFolderName"
String extr = Environment.getExternalStorageDirectory().toString() + File.separator + "YourFolderName"; File myPath = new File(extr, fileName); FileOutputStream fos = null; try { fos = new FileOutputStream(myPath); bitMap.compress(Bitmap.CompressFormat.JPEG, 100, fos); fos.flush(); fos.close(); MediaStore.Images.Media.insertImage(context.getContentResolver(), bitMap, myPath.getPath(), fileName); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); }
manifest permission must also be set
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
source share