L3n95
L3n95

Reputation: 1615

Android, Java: Improve quality of Bitmap with getDrawingCache()

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?

Upvotes: 0

Views: 818

Answers (0)

Related Questions