Loading Images into an Android device
in
Android Processing
•
9 months ago
Hi dear processing users,
I'm new to processing and Java.
So far, I've been able to solve my beginer problems with the information available on this forum, but now I can seem to find any solution about the following issue:
I have developped a sketch where an image is loaded and displayed. Here it is :
PImage button1 = loadImage("C:/Android/processing/processing-2.0b7/imageandroid/data/button.jpg");
void setup() {
size(400,400);
background(255);
}
void draw() {
image(button1,100,100);
}
In Java mode, it is working perfectly (the image is displayed)
In Android mode, after the sketch is compiled, installed and executed on my device (tested on Samsung GIO 2.3 and huawei Honor 4.0), the program won't start and will be aborted with the following message on my device:
"The application imageandroid (process processing.test.imageandroid) has stopped unexpectedly. Please try again."
And on the console :
"FATAL EXCEPTION: Animation Thread
java.lang.NullPointerException
at processing.core.PGraphics.image(Unknown Source)
at processing.core.PApplet.image(Unknown Source)
at processing.test.imageandroid.imageandroid.draw(imageandroid.java:29)
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:1019)
"
If I remove any image loading instruction in my code, I won't have any trouble starting a sketch on my device and the problem also occurs on emulator mode.
I assume this is a problem of direction/path but I'm quite lost.
For information I'm working with processing 2.07b.
I'm looking forward to your answers, thank you in advance.
Jonathan
1