0

I have a dialog and convert it to a bitmap. Then I want so send it with the Sharing Intent:

        Bitmap cs = null;
        v1.setDrawingCacheEnabled(true);
        v1.buildDrawingCache(true);
        cs = Bitmap.createBitmap(v1.getDrawingCache());
        Canvas canvas = new Canvas(cs);
        v1.draw(canvas);
        canvas.save();
        v1.setDrawingCacheEnabled(false);
        String path = Images.Media.insertImage(getContext().getContentResolver(), cs, "MyImage", null);
        Uri file = Uri.parse(path);
        Intent sharingIntent = new Intent(Intent.ACTION_SEND);
        sharingIntent.setType("image/png");
        sharingIntent.putExtra(Intent.EXTRA_STREAM, file);
        getContext().startActivity(Intent.createChooser(sharingIntent,"Share image using"));

v1 is the parent of a TextView in the dialog (v1 is what I want to send). If I send the bitmap now it has a really bad quality. How can I improve that?

Diego Sevilla
  • 28,636
  • 4
  • 59
  • 87
L3n95
  • 1,505
  • 3
  • 25
  • 49
  • Hello, I am also facing the same problem. Did you found any solution for this ? – AndyN Apr 03 '14 at 07:48
  • 1
    Hello, I did this: OutputStream outStream = null; try { outStream = getContext().getContentResolver().openOutputStream(file); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } cs = Bitmap.createScaledBitmap(cs, cs.getWidth()*2, cs.getHeight()*2, true); cs.compress(Bitmap.CompressFormat.JPEG, 100, outStream); It helped a bit. – L3n95 Apr 07 '14 at 17:41
  • Thank you will surely try out this solution in my application. – AndyN Apr 08 '14 at 05:12

0 Answers0