开发者

convert view to image in android

I'm trying to send a chart via email in android applicat开发者_JS百科ion, how can I attach that chart to email application?


Before attaching the graph to email we have to save the graph image into storage, For that you just enable the cache for that view by setting setDrawingCacheEnabled(true);

Then create the bitmap Bitmap.createBitmap(View.getDrawingCache());.

we can convert the bitmap to desired image format as follows

bitmap.compress(CompressFormat.PNG, 100, new FileOutputStream(filename));
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜