We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi, nice to meet you.
BufferedReader reader;
String line;
PFont font;
void setup() {
font = createFont("aaaa.vlw", 32);
size(1000,1500);
// Open the file from the createWriter() example
reader = createReader("positions.txt");
}
void draw() {
textFont(font);
String[] lines22;
lines22 = loadStrings("\\\\192.168.0.202\\share\\t1.txt");
for (int i = 0; i < lines22.length; i = i+1) {
text(lines22[i], 300, 200 + 100*i);
}
}
Why is there no error in JAVA? But why is not it running on Android? The concept is to share files through shared folders. And the status of the system is visible through the shared file.
Java mode works well. But Android mode does not work well. Why?
> blendMode(), or this particular variation of it, is not available with this renderer.
positions.txt does not exist or could not be read The file "\\192.168.0.202\share\t1.txt" is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable. FATAL EXCEPTION: Animation Thread Process: processing.test.android_tcp, PID: 17405 java.lang.NullPointerException: Attempt to get length of null array at processing.test.android_tcp.android_tcp.draw(android_tcp.java:38) at processing.core.PApplet.handleDraw(Unknown Source) at processing.core.PGraphicsAndroid2D.requestDraw(Unknown Source) at processing.core.PApplet.run(Unknown Source) at java.lang.Thread.run(Thread.java:818)</del>
Answers
@Gwak=== supposing the url is ok (because it is not the same in your code && the error code) have you added the internet permissions?
Error message. In my opinion, I do not seem to be approaching. It seems that the document is not accessible. I gave permission to the Internet.
It works well with JAVA. But I do not know why Android mode does not work. Is there anything I can do in Android mode?
@Gwak Check the following links: https://www.google.ca/search?q=what+is+192.168.0.x&rlz=1C1CHWA_enCA688CA688&oq=what+is+192.168.0.x&aqs=chrome..69i57.7078j0j8&sourceid=chrome&ie=UTF-8
https://www.quora.com/Can-the-IP-addresses-192-168-2-1-and-192-168-0-x-talk-to-each-other
Kf
Those slashes in the URL look to be the wrong way around to me. URLs always contain / rather than \ . you say it works in Java but maybe Java is a bit more tolerant of that stuff than android.
@Gwak===
as for android - not for java- the OpenFileInput("") works only in this context and WITHOUT file separator (see line 2 &&3 of your error code) ; it seems that P5 loadStrings in android mode uses it.
see also:
https://developer.android.com/reference/android/content/Context.html#openFileInput(java.lang.String)
@akenaton , I guess you said it exactly. Dear akhenaten,
How do I build the source code for the next step?
Also, can you solve it? please reply.
@Gwak===
not sure wether it works but, as for me, i would try to download (AsyncTask with an url connection && inputStream) the file to my storage directory in order that i can get access to it.
@akenaton
Your words are correct. It seems to be the difference between Java mode and Android mode. To solve Android mode, I implemented it with (http: :) link.
Thank you for your kind answer. Have a nice day.