SurfaceView.getHolder()
can not hold a valid value while you are still in the
onCreate()
method. It's not yet initialized at that runtime.
Activity
has other methods
protected void onResume();
protected void onPause();
That's a better place to interact with the
SurfaceView
.
Please also read in the documentation about these lifecycle controling methods:
Activity[
^] @ Android Documentation