Hello I am new to processing. I am having trouble with processing in the android mode, using "PImage" and "loadImage" when I choose "orientation(LANDSCAPE);". My simplyfied Code:
import java.util.*; //To use ArrayList
ArrayList<PImage> bilder_a;
void setup() {
fullScreen();
orientation(LANDSCAPE);
background(0);
//Load Pictures:
bilder_a=new ArrayList<PImage>();
int pic_anzahl=9;
String pic_name;
for (int i=0; i<=pic_anzahl; i++)
{
pic_name="pic_a"+i+".JPG";
bilder_a.add(loadImage(pic_name));
}
}
I use the newest stable Version of processing, 3.3 and the newest and stable Version of SDK for Windwos 10, 64Bit. I already reinstalled the two, to see whether there is a software failure. But it does not solve anything. In my Sketch folder, I have the "data" folder with all the pictures... I am using an Oukitel K10000. My code works fine, when I run it in Java-Mode, but fails in Android-Mode:
-post-build:
debug: FATAL EXCEPTION: Animation Thread Process: processing.test.trouble, PID: 11536 java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.AssetManager android.app.Activity.getAssets()' on a null object reference at processing.core.PApplet.createInputRaw(Unknown Source) at processing.core.PApplet.createInput(Unknown Source) at processing.core.PApplet.loadImage(Unknown Source) at processing.test.trouble.trouble.setup(trouble.java:36) 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) [The application does not crash, when I start it with my smartphone turned to the right landscape mode, but that is obviously not a solution...]
The strange thing is..., the Code works fully-fine even in Android-Mode, when I delete the line "orientation(LANDSCAPE);" or when i delete the line "bilder_a.add(loadImage(pic_name));". I know, the LANDSCAPE and PImage-stuff had been discussed like a thousand times.. but I never found a discussion, that focuses, the combination of LANDSCAPE and PImage, which obviously makes me trouble.
I hope you can help me, thanks a lot by now!