0

In my application, I have edit text field. And this edit text filed should allow only two spaces for Example Mike Graham John. And not allowing more than two spaces like the below word

Mike Graham John Abraham. I have tried with InputFilter, but I am unable to get it.

Can any one please help me on this Thanks!

rams
  • 1,558
  • 7
  • 25
  • 48
  • What does your non-functioning `InputFilter.filter()` code look at the moment? Would it be possible to keep track of the number of spaces? Related discussion: [https://stackoverflow.com/questions/3349121/how-do-i-use-inputfilter-to-limit-characters-in-an-edittext-in-android](https://stackoverflow.com/questions/3349121/how-do-i-use-inputfilter-to-limit-characters-in-an-edittext-in-android) – Markus Kauppinen Jul 07 '23 at 11:17
  • A [TextWatcher](https://developer.android.com/reference/android/text/TextWatcher) could be an alternative way to do this. (With its own caveats like infinite loops.) – Markus Kauppinen Jul 07 '23 at 11:18

0 Answers0