Null pointer error in thread

Let me explain what the registerMethod() approach is suppose to achieve.

Your class A runs on its own Thread, but you can’t draw/mutate the sketch’s main canvas from it.

By using registerMethod() you can forward class A’s rendering parts to the sketch’s “Animation” Thread, leaving to class A’s Thread only the parts which isn’t about drawing.

As a workaround, you can have a separate PGraphics’s inside your class A, and leave to its registered customized callback draw() the task to display it.