Open sumitsh87 opened 10 years ago
No, you can't pass in the base64 encoded string quite like that, you'll need to decode it first. That method basically expects properly formed XML in a plain String.
That's a https://en.wikipedia.org/wiki/Data_URI_scheme form
My SVG image (Base64 encoded) is "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMTAwIiB3aWR0aD0iMTAwIj48Y2lyY2xlIGN4PSI1MCUiIGN5PSI1MCUiIHI9IjQ5LjEiCiAgICAgICAgICBmaWxsPSJ3aGl0ZSIvPiI8dGV4dCB4PSIyNSUiIHk9IjYwJSIgc3R5bGU9ImZvbnQtZmFtaWx5OiBjb3VyaWVyIG5ldzsgZm9udC13ZWlnaHQ6bm9ybWFsOyBmb250LXN0eWxlOiBub3JtYWwiIGZvbnQtc2l6ZT0iNDBweCIgPlBVPC90ZXh0Pjwvc3ZnPgogICAgICAgIA=="
when I set it to ImageView in ANdroid using SVG svg = SVGParser.getSVGFromString("data:image......A==") imageView.setLayerType(View.LAYER_TYPE_SOFTWARE, null); PictureDrawable pictureDrawable = svg.createPictureDrawable(); stubBitmap = Bitmap.createBitmap(pictureDrawable.getIntrinsicWidth(), pictureDrawable.getIntrinsicHeight(), Config.ARGB_8888); imageView.setImageBitmap(stubBitmap);
I get the following error: E/AndroidRuntime(28379): com.larvalabs.svgandroid.SVGParseException: org.apache.harmony.xml.ExpatParser$ParseException: At line 1, column 350: not well-formed (invalid token)
Please help.