I want an ediText field in my app to respond to onTextChange events so a method is called when the text changes. I am using dot42 to make the app but could only find tutorials available in Java.
This would be a minimal implementation. I hope it helps you see a pattern in the difference between Java and C# - it is really trivial.
[Activity]
public class MainActivity : Activity, Android.Text.ITextWatcher
{
protected override void OnCreate(Bundle savedInstance)
{
base.OnCreate(savedInstance);
SetContentView(R.Layouts.MainLayout);
EditText editText = FindViewById<EditText>(R.Ids.status);
editText.AddTextChangedListener(this);
}
public void AfterTextChanged(Android.Text.IEditable s)
{
throw new NotImplementedException();
}
public void BeforeTextChanged(Java.Lang.ICharSequence s, int start, int count, int after)
{
throw new NotImplementedException();
}
public void OnTextChanged(Java.Lang.ICharSequence s, int start, int before, int count)
{
throw new NotImplementedException();
}
}
The interface implementation is generated by Visual Studio.