I try to save the picture, nothing comes out. I use two methods for saving and loading.
private String saveToInternalStorage(Bitmap bitmapImage) throws IOException { ContextWrapper cw = new ContextWrapper(getApplicationContext()); // путь /data/data/yourapp/app_data/imageDir File directory = cw.getDir("imageDir", Context.MODE_PRIVATE); // Создаем imageDir File mypath=new File(directory,"user.png"); FileOutputStream fos = null; try { fos = new FileOutputStream(mypath); // Используем метод сжатия BitMap объекта для записи в OutputStream bitmapImage.compress(Bitmap.CompressFormat.PNG, 100, fos); } catch (Exception e) { e.printStackTrace(); } finally { fos.close(); } return directory.getAbsolutePath(); } private void loadImageFromStorage(String path) { try { Toast.makeText(this, "Загружено", Toast.LENGTH_LONG).show(); File f=new File(path, "user.png"); Bitmap b = BitmapFactory.decodeStream(new FileInputStream(f)); channelLogo.setImageBitmap(b); } catch (FileNotFoundException e) { e.printStackTrace(); } } Here I save the picture by pressing the menu button
case R.id.save: Bitmap icon = BitmapFactory.decodeResource(getApplicationContext().getResources(), R.drawable.user); try { saveToInternalStorage(icon); Toast.makeText(this, "Сохранено", Toast.LENGTH_LONG).show(); } catch (IOException e) { e.printStackTrace(); } return true; Here I upload. Method located in the method OnCreate
loadImageFromStorage("/data/data/yourapp/app_data/imageDir");