The application saves bitmap. Here is the code to save them

public Save(Bitmap bitmap,String folder) { /*создаем имя файла*/ editName(); OutputStream os = null; String folderToSave = Environment.getExternalStoragePublicDirectory( Environment.DIRECTORY_PICTURES).toString()+folder; if(folder.equals(Main2Activity.FOLD_TEMP)) { Main2Activity.tempPathBitmap.add(folderToSave +"/"+name); } /*проверяем есть ли папка в которую идет сохраненме * если ее нет метод ее создает*/ createDir(folderToSave); File file = new File(folderToSave,name); try { os = new FileOutputStream(file); bitmap.compress(Bitmap.CompressFormat.PNG, 85, os); os.flush(); os.close(); }catch (Exception e){ e.printStackTrace(); } } public static void createDir(String path){ File file = new File(path); if(!file.exists()){ file.mkdirs(); } } 

In android-4 and android-5 everything works, but in android-6 does not want. And yes, in the manifesto I wrote:

 uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> 

    1 answer 1

    API 23 (Android 6) introduced so-called. runtime permissions - now for obtaining some ( dangerous ) permissions, besides the corresponding line in the manifest, you also need to request these permissions during the execution of the application.

    WRITE_EXTERNAL_STORAGE belongs to the category of dangerous permissions , respectively, to write files you need to request this permission from the user in runtime.

    More details: Requesting Permissions at Run Time .

    • I assumed that the case is in the version of the android with its permissions, but I did not understand how to deal with this from the code. Thank you very much, you helped me a lot. - Igor