Android, Java: Improve quality of Bitmap with getD

2019-08-29 02:36发布

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?

0条回答
登录 后发表回答