Key input and focus handling occurs exactly the same as a regular view -- really all SurfaceView is, is just a regular view that draws a transparent area for itself, and creates and display a (non-input-receiving) window behind its own window.
On Wed, Jan 13, 2010 at 11:41 AM, guiha...@gmail.com <guiha...@gmail.com>wrote: > Hi, > > I have this View: > > public class Launcher4A extends SurfaceView implements > SurfaceHolder.Callback, OnKeyListener > { > public Launcher4A(Context context) > { > super(context); > System.loadLibrary("tcvm"); > instance = this; > surfHolder = getHolder(); > surfHolder.addCallback(this); > setWillNotDraw(true); > setFocusable(true); > requestFocus(); > setOnKeyListener(this); > } > > public boolean onKey(View v, int keyCode, KeyEvent event) > { > Log.i("TotalCross", "onKeyDown "+keyCode); > return true; > } > } > > When i run the application in Emulator, the onKey is never called if > the Launcher4A class was clicked inside. Actually, i was able to get > the onKeyDown log once, when i clicked somewhere outside the view, but > i'm unable to get it when the view has focus. > > Am I missing something? > > Best, > > guich > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them.
-- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en