0

Hello im writing an android app using the android svg-android.jar. (I think it's the google official library) I'm trying to parse my svg im getting an error. my svg falls on this line :

<stop  offset="0.1774" style="stop-color:#EDEDED;stop-opacity:0.2"/>

the error i get is this : java.lang.NumberFormatException: Invalid int: "EDEDED;stop-opacity:0.2"

in the google code for the project i saw this :

if (gradient != null) {
                    float offset = getFloatAttr("offset", atts);
                    String style = getStringAttr("style", atts);
                    if (style.startsWith("stop-color:#")) {
                        int color = Integer.parseInt(style.substring("stop-color:#".length()), 16);
                        color |= 0xFF000000;
                        gradient.positions.add(offset);
                        gradient.colors.add(color);
                    }
                }

it seems that google can't handle the style having opacity too. the svg itself is generated through a program . my question is this: is there another android library for svg parsing ? i searched and couldn't find .

does the google code site doens't have the latest code ?(google i heard stopped supporting it)

is there another way to give opacity to the stop element which doesn't include the style attribute ?

or most annoying option should I wait for whoever wrote it to fix it ?(commented on google code project site also but the last comment is from 2014 don't know if i get referrenced at all).

help would be appreciated thanks !

Chenshov
  • 17
  • 3
  • 2
    svg-android was moved to github. It says so in the first line of the landing page. This does **not** appear to be official google/android in any way, and even the github project, while containing more recent comments, seems abandoned. Good luck! – 323go Apr 13 '15 at 13:58
  • Definitely not an official Google library. – alanv Apr 13 '15 at 19:59

1 Answers1

0

There is another to give opacity to the stop element which doesn't include the style attribute, mapped CSS attributes e.g.

<stop offset="0.1774" stop-color="#EDEDED" stop-opacity="0.2"/>
Robert Longson
  • 118,664
  • 26
  • 252
  • 242