I am a new comer to Android development so I imagine I have a simple problem, but I can't seem to figure out what's wrong.
I basically copied the LunarLander game example from the samples, but I tried to to only copy the parts I needed to make a little pong game or something. But for some reason, onKeyUp and onKeyDown are not getting called. Part of the problem is I'm still not exactly sure what the debugging methodology for Android is.
public class PongView extends SurfaceView implements SurfaceHolder.Callback{
...
/**
* Standard override for key up. Used to move the paddles
* @return
*/
@Override
public boolean onKeyUp(int keyCode, KeyEvent msg) {
return thread.doKeyUp(keyCode, msg);
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent msg) {
return thread.doKeyDown(keyCode, msg);
}
...
}
EDIT SOLUTION:
I forgot to put this line in my View's constructor.
setFocusable(true);