Android Question How to detect accent characters in a text box?

Discussion in 'Android Questions' started by Inman, Feb 12, 2019.

  1. Inman

    Inman Well-Known Member Licensed User

    In my app, some users enter their names using accent characters. Basically these are the characters you get when you long-press certain letters. Like when you do that on 'a', you can see some characters like 'a' with two dots on top and all. I want to check if a field contains one or more of such characters and show an error message.

    I saw the code snippet that removes accent characters. What is the way to detect them?

    [​IMG]
     
  2. Geezer

    Geezer Active Member Licensed User

    If they're entering their names in an edittext you can set allowable characters and restrict the input.

    If the names already exist, such as in a database, use the code snippet you referenced.
     
    DonManfred likes this.
  3. Inman

    Inman Well-Known Member Licensed User

    Thanks @Geezer . How do I set allowable characters for EditText? I can see InputType but it doesn't seem to have a type for English characters only.
     
  4. Geezer

    Geezer Active Member Licensed User

  5. Inman

    Inman Well-Known Member Licensed User

    While it is a good solution, unfortunately it won't work in my case. IME library works only with EditText and I am using DSFloatLabelEditText. I get an "incompatible types" error during compilation.

    I am wondering if I should look at regex to check for such characters. Sadly I am not good with regex.
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    Sounds like a mistake. Use B4XFloatLabeledTextField.

    You will get access to the internal EditText.
     
  7. Inman

    Inman Well-Known Member Licensed User

    Thanks Erel. I will try that.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice