Hello,
I am having a bit of trouble with what should be a simple bit of code, a lightweight drawing engine using SurfaceView. At the moment my engine instantiates a second class, GameView, which extends SurfaceView and implements SurfaceHolder.Callback. In the constructor for this class I call getHolder(), pass the resulting object's .callback 'this', and set the view as focusable. Everything goes swimmingly until I get to surfaceCreated(), it just never gets called. It seems to me like there should be another call to set the surface viewable but this is the procedure the Dev guides (and several individual tutorials) have outlined.
Has anybody had similar troubles? I know I must be missing something simple but I cannot for the life of me figure out what it is. All sources reside in the same package and are instantiated in the same activity (which just has a button to create the engine and so on).
References:
Graphics | Android Developers
Blorb Development Blog - Simple Java Android Game Loop
Playing with graphics in Android
I am having a bit of trouble with what should be a simple bit of code, a lightweight drawing engine using SurfaceView. At the moment my engine instantiates a second class, GameView, which extends SurfaceView and implements SurfaceHolder.Callback. In the constructor for this class I call getHolder(), pass the resulting object's .callback 'this', and set the view as focusable. Everything goes swimmingly until I get to surfaceCreated(), it just never gets called. It seems to me like there should be another call to set the surface viewable but this is the procedure the Dev guides (and several individual tutorials) have outlined.
Has anybody had similar troubles? I know I must be missing something simple but I cannot for the life of me figure out what it is. All sources reside in the same package and are instantiated in the same activity (which just has a button to create the engine and so on).
References:
Graphics | Android Developers
Blorb Development Blog - Simple Java Android Game Loop
Playing with graphics in Android