code: public static boolean storeOnApplicationPrivateDir(Context context, Bitmap bitmap, String filename, Bitmap.CompressFormat format, int quality) {
          OutputStream out = null;
          try {
              out = new BufferedOutputStream(context.openFileOutput(filename, Context.MODE_PRIVATE));
              return bitmap.compress(format, quality, out);
          } catch (FileNotFoundException e) {
              Log.e(TAG, "no such file for saving bitmap: ", e);
              return false;
          } finally {
              CloseableUtils.close(out);
          }
      }
docs: Store the bitmap on the application private directory path.
  @param context the context.
  @param bitmap to store.
  @param filename file name.
  @param format bitmap format.
  @param quality the quality of the compressed bitmap.
  @return the compressed bitmap file.