Skip to content

Commit

Permalink
Update Utils.java
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisTomAlx authored Apr 9, 2020
1 parent 4e1c6fb commit 314c0d6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion library/src/main/java/com/scanlibrary/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Calendar;

/**
* Created by jhansi on 05/04/15.
Expand All @@ -21,11 +22,12 @@ public static Uri getUri(Context context, Bitmap bitmap) {
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, bytes);
String path = MediaStore.Images.Media.insertImage(context.getContentResolver(), bitmap, "Title", null);
MediaStore.Images.Media.insertImage(context.getContentResolver(), bitmap, "Title" + " - " + Calendar.getInstance().getTime(), null);
return Uri.parse(path);
}

public static Bitmap getBitmap(Context context, Uri uri) throws IOException {
Bitmap bitmap = MediaStore.Images.Media.getBitmap(context.getContentResolver(), uri);
return bitmap;
}
}
}

0 comments on commit 314c0d6

Please sign in to comment.