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

拈花ヽ惹草 提交于 2019-12-13 04:36:02

问题


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?

来源:https://stackoverflow.com/questions/22560225/android-java-improve-quality-of-bitmap-with-getdrawingcache

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!