public static File writeBitmap(Context context, Bitmap bitmap, String dir, String filename) {
        if ((bitmap == null) || TextUtils.isEmpty(dir) || TextUtils.isEmpty(filename)) {
            return null;
        }
        final File dirFile = new File(context.getFilesDir(), dir);
        return writeBitmapToDirectory(bitmap, filename, dirFile);
    }
public static File writeBitmap ( Context context , Bitmap bitmap , String dir , String filename ) { if ( ( bitmap == null ) || TextUtils . isEmpty ( dir ) || TextUtils . isEmpty ( filename ) ) { return null ; } final File dirFile = new File ( context . getFilesDir ( ) , dir ) ; return writeBitmapToDirectory ( bitmap , filename , dirFile ) ; }
Writes a {@link Bitmap} object to a file in the current context's files directory.

@param context The current context.
@param bitmap The bitmap object to output.
@param dir The output directory name within the files directory.
@param filename The name of the file to output.
@return A file where the Bitmap was stored, or {@code null} if the write
operation failed.