java - How do I convert a RelativeLayout with an Imageview and TextView to a PNG image? -
in android app activity, have relativelayout 1 imageview , couple of textviews being populated @ runtime. have save button in activity use save image in imageview device sd card. want convert elements (image , text in relativelayout) png image when save button clicked , save sd card.
have tried conversion before? helpful if can give me hints or code snippets on how go doing this?
the save functionality works fine saves image in imageview.
thanks in advance.
relativelayout
subclass of view
, , following should work view:
final view v; // view want save image bitmap bitmap = bitmap.createbitmap(v.getwidth(), v.getheight(), bitmap.config.argb_8888); canvas c = new canvas(bitmap); v.draw(c); file outputfile; // save fileoutputstream out = new fileoutputstream(imagefile); boolean success = bitmap.compress(compressformat.png, 100, out); out.close();
add exception handling @ leisure. ;)
Comments
Post a Comment