Android getting image URI from bitmap

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);
}
Advertisements

Posted on May 18, 2012, in Education and tagged , . Bookmark the permalink. 6 Comments.

  1. Hey colinyeoh! Thanks a lot.. 🙂

  2. hey thanks a lot,,it helped me solve a issue 🙂

  3. I’m new to learn android development. It’s a definitely good solution. But if i don’t want compress the image then what change i do in this code..please answer me.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

%d bloggers like this: