android - Image not getting displayed in imageView (TileView) -
i having issues setting custom decoder in setdecoder() method of tileview android library. nothing getting displayed on screen. having svg image , converting same bitmap using android svg library.kindly help. pfb code on create method in main class
@override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); tileview tileview = new tileview(this); tileview.setsize(600, 400); tileview.setlayertype(view.layer_type_software, null); tileview.settiledecoder(new bitmapdecoderassetscustom(this)); setcontentview(tileview); }
the bitmapdecoderassetscustom decoder class.
public class bitmapdecoderassetscustom implements bitmapdecoder { public bitmapdecoderassetscustom(context c){ decode("acid1_embedcss.svg",c); } @override public bitmap decode(string s, context context) { bitmap obj=null; try { svg svg = svg.getfromasset(context.getassets(), "acid1_embedcss.svg"); system.out.println("document width "+svg.getdocumentwidth()); system.out.println("document height "+svg.getdocumentheight()); obj = bitmap.createbitmap((int)math.ceil(svg.getdocumentwidth()), (int) math.ceil(svg.getdocumentheight()), bitmap.config.argb_8888); } catch (svgparseexception e) { e.printstacktrace(); } catch (ioexception e) { e.printstacktrace(); } return obj; } }
you parsing svg, , creating bitmap. @ no point rendering svg bitmap.
there example of how on androidsvg home page.
Comments
Post a Comment