Repository navigation
Creating a custom renderer #2390
Copy link
Copy link
Closed
Description
Hi there, just working on something that will resolve the problems SMT was having with the latest version of processing - a custom renderer. I have it working fully on the desktop on Windows and Linux ( can't test on mac ). I ran into a problem on Android however.
This works on the desktop:
void setup(){
size( 800, 600, Renderer.class.getName());
}
void draw(){
background( 30);
fill( 200, 100, 100, 200);
noStroke();
rect( 10, 10, 100, 100);
}
/*
public int sketchWidth() {
return 800;
}
public int sketchHeight() {
return 600;
}
public String sketchRenderer() {
return Renderer.class.getName();
}
*/
public static class Renderer extends PGraphics3D {
public Renderer(){
super();}
}However this fails on android:
void setup(){
//size( 800, 600, Renderer.class.getName());
}
void draw(){
background( 30);
fill( 200, 100, 100, 200);
noStroke();
rect( 10, 10, 100, 100);
}
public int sketchWidth() {
return 800;
}
public int sketchHeight() {
return 600;
}
public String sketchRenderer() {
return Renderer.class.getName();
}
public static class Renderer extends PGraphics3D {
public Renderer(){
super();}
}With the following logcat output:
D/AndroidRuntime(17635):
D/AndroidRuntime(17635): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
D/AndroidRuntime(17635): CheckJNI is OFF
D/AndroidRuntime(17635): Calling main entry com.android.commands.am.Am
D/AndroidRuntime(17635): Shutting down VM
D/AndroidRuntime(17649):
D/AndroidRuntime(17649): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
D/AndroidRuntime(17649): CheckJNI is OFF
D/AndroidRuntime(17649): Calling main entry com.android.commands.pm.Pm
D/AndroidRuntime(17649): Shutting down VM
I/AndroidRuntime(17649): NOTE: attach of thread 'Binder Thread #3' failed
D/AndroidRuntime(17713):
D/AndroidRuntime(17713): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
D/AndroidRuntime(17713): CheckJNI is OFF
D/AndroidRuntime(17713): Calling main entry com.android.commands.am.Am
D/AndroidRuntime(17713): Shutting down VM
I/AndroidRuntime(17713): NOTE: attach of thread 'Binder Thread #3' failed
D/AndroidRuntime(17741): Shutting down VM
E/AndroidRuntime(17741): FATAL EXCEPTION: main
E/AndroidRuntime(17741): java.lang.RuntimeException: Unable to start activity ComponentInfo{processing.test.asdf/processing.test.asdf.asdf}: java.lang.NullPointerException
E/AndroidRuntime(17741): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1960)
E/AndroidRuntime(17741): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1985)
E/AndroidRuntime(17741): at android.app.ActivityThread.access$600(ActivityThread.java:127)
E/AndroidRuntime(17741): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1151)
E/AndroidRuntime(17741): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(17741): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(17741): at android.app.ActivityThread.main(ActivityThread.java:4447)
E/AndroidRuntime(17741): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(17741): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(17741): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
E/AndroidRuntime(17741): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
E/AndroidRuntime(17741): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(17741): Caused by: java.lang.NullPointerException
E/AndroidRuntime(17741): at android.view.ViewGroup.addViewInner(ViewGroup.java:3342)
E/AndroidRuntime(17741): at android.view.ViewGroup.addView(ViewGroup.java:3214)
E/AndroidRuntime(17741): at android.view.ViewGroup.addView(ViewGroup.java:3184)
E/AndroidRuntime(17741): at processing.core.PApplet.onCreate(Unknown Source)
E/AndroidRuntime(17741): at android.app.Activity.performCreate(Activity.java:4466)
E/AndroidRuntime(17741): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1092)
E/AndroidRuntime(17741): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1924)
E/AndroidRuntime(17741): ... 11 more
Help of any kind would be nice. Advice as to where to look and the like would be great.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
codeanticode commentedon Mar 12, 2014
hello, since this is an android issue could you re-open it on the processing-android repo?
kiwistrongis commentedon Mar 13, 2014
Your wish is my command
github-actions commentedon Jun 16, 2021
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.