1. Are you ready for the Galaxy S20? Here is everything we know so far!

EditText conditional problem

Discussion in 'Android Development' started by alavro_, Jun 1, 2021.

  1. alavro_

    alavro_ Lurker
    Thread Starter

    So i have a EditText field, which i want to, check if the age is above and under my limits.

    if (Integer.parseInt(age.getText().toString()) < 18 && Integer.parseInt(age.getText().toString()) >= 0)
    But also, i want to simply check if the field is empty, for what i used.

    else if (age.getText().toString().isEmpty())

    Unluckly this one is not working, i think it sort of get in to conflict with the first one or something, because i tried with just one condition of both, and it works..
    I also tried to store in String variable the method to check isEmpty(), and also in int one, to do the age comparation, but it still not working.

    Thanks in advance.
     



    1. Download the Forums for Android™ app!


      Download

       
Loading...

Share This Page

Loading...