Friday, 15 February 2013

image - Creating Bitmap on the fly in android and share it using Intent without losing quality -



image - Creating Bitmap on the fly in android and share it using Intent without losing quality -

i'm using below code taking view parameter , create bitmap it:

public bitmap screenshot(view view) { bitmap bitmap = bitmap.createbitmap(view.getwidth(), view.getheight(), config.argb_8888); canvas canvas = new canvas(bitmap); view.draw(canvas); homecoming bitmap; }

now i'm using code taking screen shot specific view , share using intent:

bitmap captured = commons.screenshot(view); string pathofbmp = images.media.insertimage(getcontentresolver(), captured,"title", null); uri bmpuri = uri.parse(pathofbmp); intent emailintent1 = new intent(android.content.intent.action_send); emailintent1.settype("image/jpeg"); emailintent1.setflags(intent.flag_activity_new_task); emailintent1.putextra(intent.extra_stream, bmpuri); startactivity(intent.createchooser(emailintent1, "share image using"));

it works perfect. result image black background , low quality. i've searched lot, illustration this way(bad image quality after resizing/scaling bitmap), problem still exists. idea? give thanks in advanced.

android image android-intent bitmap

No comments:

Post a Comment