-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Removed reflection on java.lang.String. Was causing a crash on M #10
base: master
Are you sure you want to change the base?
Conversation
Can someone take a look at this? I also encountered this issue and unless this gets merged, the library does not work on android 6 |
I'm using this fix in my fork https://github.com/tinsukE/svg-android. You can use it in gradle/maven with https://jitpack.io/:
|
@tinsukE your repo isn't listed in mavancentral.. how can I use your fork? |
@vitorprado I'm sorry I wasn't clear. I've updated my answer, and you can check out more about it: |
@tinsukE Thanks! |
private final char[] s; | ||
private final int n; | ||
private char current; | ||
public int pos; | ||
|
||
public ParserHelper(String str, int pos) { | ||
try { | ||
this.s = (char[]) STRING_CHARS.get(str); | ||
this.s = str.toCharArray(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may be costly, because toCharArray() copies the characters, as the javadoc says. This object might be constructed many times even during processing a single image. I have changed s to be a String, and use charAt() instead of getting from an array. Should charAt() be fast, it is a native method in newer SDKs, older use array access inside.
Should actually measure performance, it works as fast as previously (as perceived) for me anyway.
Removed reflection on java.lang.String. Was causing a crash on Android M