Hi, I wanted to set the SetOnKeyListener on EditText field.
To do this, I got various samples in java. I have followed below steps to achieve this functionality. 1) Retrived the EditText field from layout as below EditText txtSearch = FindViewById<EditText >(Resource.Id.txtSearch); 2) As the SetOnKeyListener requires View.IOnKeyListener.OnKey, I have created a another class which implements the OnKey method of the View.IOnKeyListener interface as below. public class clsKeyListner : View.IOnKeyListener { #region IOnKeyListener Members public bool isEnterKeyPressed = false; bool View.IOnKeyListener.OnKey(View v, int keyCode, KeyEvent e) { //66 is the code for Enter key if (e.Action == KeyEventActions.Down && keyCode == 66) { isEnterKeyPressed = true; return true; } return false; //throw new NotImplementedException(); } #endregion #region IJavaObject Members IntPtr IJavaObject.Handle { get { throw new NotImplementedException(); } } #endregion } 3) Then created the instance of above class and tried to set the listener to the EditText field. clsKeyListner objclsKeyListner = new clsKeyListner(); edtPharmacyAddress.SetOnKeyListener(objclsKeyListner); The above code works fine but I want to call web service when user clicks on "Enter" key on virtual keyboard and once I receive the response from web service, I want to set it to the List. but I am unable to do it as I am calling the web service in the second class and how to set that response in the layout which is present in the first activity class. Please help me with your suggestions/ code samples. It will be great if we can set listener and call web service in the same class so that we can assign the response to the list. Thanks, Nilesh -- View this message in context: http://mono-for-android.1047100.n5.nabble.com/Setting-SetOnKeyListener-on-EditText-tp4778312p4778312.html Sent from the Mono for Android mailing list archive at Nabble.com. _______________________________________________ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid