Are you trying to capture the back key which normally would act like
cancel? Or are you trying to capture the backspace key, which
deletes the previous character? If it is the latter, you should use
KeyEvent.KEYCODE_DEL. If it is the former, you might try changing
your code as follows to get more diagnostic info:
> @Override
> public View onCreateView(LayoutInflater inflater, ViewGroup container,
> Bundle savedInstanceState) {
>
> View myView = inflater.inflate(R.layout.note, null);
>
> myView.setOnKeyListener(
> new OnKeyListener(){
> @Override
> public boolean onKey( View v, int keyCode, KeyEvent
> event ){
> Log.V("keyCode=" + keyCode);
> if( keyCode == KeyEvent.KEYCODE_BACK
> ){
> Log.v("CALL ME", "I am
> called");
> return true;
> }
> return false;
> }
> });
>
> return myView;
>
> }
This will confirm whether or not your onKey() is even being called and
what keyCode value is being received.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en