We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello,
when I tried changing the mode from Java, where the program was working, to Android mode, where I get the path separator
error.
I'm putting in the following code, on which it crashes
loadStrings("http://mglolenstine.xyz/test.txt");
and I get the following error:
` FATAL EXCEPTION: Animation Thread Process: processing.test.monitor, PID: 19520 java.lang.IllegalArgumentException: File http://mglolenstine.xyz/text.txt contains a path separator at android.app.ContextImpl.makeFilename(ContextImpl.java:1944) at android.app.ContextImpl.getFileStreamPath(ContextImpl.java:549) at android.content.ContextWrapper.getFileStreamPath(ContextWrapper.java:193) at processing.core.PSurfaceNone.getFileStreamPath(Unknown Source) at processing.core.PApplet.sketchPath(Unknown Source) at processing.core.PApplet.createInputRaw(Unknown Source) at processing.core.PApplet.createInput(Unknown Source) at processing.core.PApplet.loadStrings(Unknown Source) at processing.test.trtl_monitor.Monitor.draw(Monitor.java:55) at processing.core.PApplet.handleDraw(Unknown Source) at processing.core.PSurfaceNone.callDraw(Unknown Source) at processing.core.PSurfaceNone$AnimationThread.run(Unknown Source)
`
And I don't understand... I've read this article, but it doesn't seem to help me, as the OP fixed it by adding HTTP:// in front of 'his' url.
Answers
After searching for android solutions not related to Processing, I've found this piece of code:
Just wanted to share, so if anyone has the same problem it can be easily resolved!
Thxs for sharing.
Kf
@MGlolenstine
I tested with the following code and it worked. I have internet permissions enabled. Notice I was getting this warning:
Although it seems it was addressed already: https://github.com/processing/processing-android/issues/332
Other searches return this is a warning associated with Samsung devices (my case).
Kf
@kfrajer interesting...
So you just use HTML and it works?
Could you explain why it works?
thanks :D
@MGlolenstine===
i don't understand : though inputStream can be used more simple is to write
}
@MGlelenstine
Not sure why yours didn't work. If you post and MCVE, then one can either reproduce the problem or understand your approach and probably suggest what needs to be modified or an alternative approach. What I did hear was a simple test demo showing it works. I am not familiar with the calls Processing Android is doing under the hood. However, it is very easy to understand it if you check the Github repo.
Kf