I am trying to drawn on a TextureView with a canvas in Android. I am doing it inside a thread but for some reason, when I try to run my program, I am getting a null pointer exception. I have implemented my thread in the surfaceAvailable() callback but I'm still unable to draw. What could I be doing wrong?
This is what i tried so far:
This is my stacktrace:
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.graphics.Canvas.drawColor(int, android.graphics.PorterDuff$Mode)' on a null object reference