Reputation: 4652
I'm trying to understand why should I use a SurfaceHolder.Callback
where I can do a lot without it. A question raised up I can put some code in the constructor of the main SurfaceView , why should I then use it. What's the difference and what's the situation where I MUST use SurfaceHolder.Callback
Thanks.
Upvotes: 0
Views: 351
Reputation: 48262
SurfaceHolder.Callback
notifies you when the surface is created, changed and destroyed.
If you're drawing to the surface in a separate thread (which is what SurfaceView
is all about) you will want to know that to determine when you can start/stop your drawing.
The surface is not available immediately after it's constructor called. And there will be problems if you draw to a destroyed surface, too.
Upvotes: 1