Skip to content

Instantly share code, notes, and snippets.

@malikkurosaki
Created October 8, 2018 13:06
Show Gist options
  • Save malikkurosaki/876beeb9957df350a483fc0c4e7427ab to your computer and use it in GitHub Desktop.
Save malikkurosaki/876beeb9957df350a483fc0c4e7427ab to your computer and use it in GitHub Desktop.
malikkurosaki bitmap to uri
public Uri getImageUri(Context inContext, Bitmap inImage) {
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
inImage.compress(Bitmap.CompressFormat.JPEG, 100, bytes);
String path = Images.Media.insertImage(inContext.getContentResolver(), inImage, "Title", null);
return Uri.parse(path);
}
@myroniak
Copy link

The best solution ever!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment