Search code examples
androidif-statementtextview

Android : How to get the textview value and compare


Iam a newbie So How to get the number value of textview and compare it that if it less than a 100 for example some other textview text changes to whatever i want ????

for example that if {textview1 < 25 || > 100} i want to change the textview2 text to be "Hello" else textview2 text "Goodbye"

Iam using fragment Activity


Solution

  • Should be something like this

    textview2.Text = if (textview1.Text.ToInt() < 25 || textview1.Text.ToInt() > 100) "Hello" else "Goodbye"