Forum Xamarin.Android
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Android.Text.IInputFilter Implementation best approach

PulkitPulkit AUMember ✭✭

I would like to implement the above interface to have a custom Filter for my TextView/EditText. What would be the best way to do above in Xamarin. The implemented methods need me to return ICharSequence from one of the methods and IntPtr from another. Dont know how Xamarin uses them, and I have had crashes using ICharsequence, when .net VM is trying to access it in DVM


  • ChrisHonselaarChrisHonselaar NLBeta ✭✭✭

    Java.Lang.String implements ICharSequence, so you would probably work with that (or a C# string and convert that to Java.Lang.String).

  • PulkitPulkit AUMember ✭✭

    What about the Handle, what should I return for that

  • CheesebaronCheesebaron DKInsider, University mod

    If you are trying to implement IInputFilter you will need to inherit from Java.Lang.Object. This will help you implement the Handle.

    public class Filter : Java.Lang.Object, IInputFilter
        public ICharSequence FilterFormatted(ICharSequence source, int start, int end, ISpanned dest, int dstart, int dend)
Sign In or Register to comment.