Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

How to use Listeners (NOT EVENTS) in Xamarin

$
0
0

I must use OnKeyDown listener of the EditText object to catch a key. I can't use the KeyPress event in my situation (long story). So how can I achieve this. I tried:

public class MyKeyListener : Java.Lang.Object, EditText.IOnKeyListener { public bool OnKeyDown(Keycode k, KeyEvent e) { //do something return false; } }

I put this code in my apps own namespace, and then I set the listener: input.SetOnKeyListener (new MyKeyListener ());

But it just gave the error: Error CS0535: 'Android.Views.MyKeyListener' does not implement interface member 'Android.Views.View.IOnKeyListener.OnKey(Android.Views.View, Android.Views.Keycode, Android.Views.KeyEvent)'

How can I achieve this?


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>