AndroidFillableLoaders
AndroidFillableLoaders copied to clipboard
github.jorgecastillo.svg.SvgPathParser.ParsePath()
I am new in Android Studio Development
could you please guide me how to resolve this error to find the null point of string path error in SvgPathParser class parsePath() function pathstring not found.
I have same issues.I could not solve it.
Can you2 paste some code producing this or what did you follow when this appeared?
(I am not on computer but lets get more info).
Can you print/share the value of you path (SvgPath.Bag.path)? It seems like that is NULL...
(your replies are a bit messed since you reply on mails)
Ok, so since public FillableLoaderBuilder svgPath(String svgPath)
takes String and you feed it with val
we can start with that alignment. Here I assume that path contains something like string with "\n" for end of line characters, some string numbers with dots and stuff (so not OS path)...
Yes my path contains "\n" and "+".What do you think?
Did you try to change the path variable from val to String? It seems like the length is somehow null and that hits the null pointer exception.
It is already 'val path: String?' when I change it to 'path: String?',this does not refers path 'val path= SvgPath.Bag.path'
I would indeed change val path= SvgPath.Bag.path
to String path= SvgPath.Bag.path
to make it more explicit. You confirmed with debugger that path
then contains a proper string which is passed to svgPath()? Just go step by step with break points if logcat print messages are not revealing enough.
In Kotlin language, val path= SvgPath.Bag.path
refers to Java's String path= SvgPath.Bag.path
Path does not comes null I checked that but I have no idea about what is the problem :(
Kotlin... huh I am indeed rusty. Can you again paste the LogCat error and a nicely formatted example? I was on Java, but this might be issue with Kotlin calling Java?
java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference at com.github.jorgecastillo.svg.SvgPathParser.parsePath(SvgPathParser.java:52) at com.github.jorgecastillo.FillableLoader.buildPathData(FillableLoader.java:374) at com.github.jorgecastillo.FillableLoader.onSizeChanged(FillableLoader.java:224)
this is LogCat error
So the error reads exactly what I said, but what you pasted before was .build()
method - so I assume logcat marks that line as failure in your application? You will have to give a lot more information if you want me to help you debug this, because now I can only guess.
https://gist.github.com/aligkts/94722473e34f55b812c56ca1977f3b37 https://gist.github.com/aligkts/2f3c1f5ef55ba594fd84dad3d2adb99b https://gist.github.com/aligkts/560b8c1da5b1a743fde3f8c8d3c93e50
You can check it from these links easily.
OK few ideas (remember don't know Kotlin syntax or background so might be totally off):
- I assume you confirmed without this lines the fragment loads (put a textview in to start with), because I remember you have to inflate fragments and stuff like that
- Maybe a simple var string instead of enum class would do the trick (although I read over Kotlin help on enum class and it should return String like you say it does)
- For future you are missing fillableLoader.setOnStateChangeListener(this); later on, because I see your error originates from: com.github.jorgecastillo.FillableLoader.onSizeChanged(FillableLoader.java:224), which might also be something coming from onStateChange trigger in second loop (error is kinda short and does not map to your code so I am guessing again).