M
M
m9ru2016-06-22 00:35:39
Android
m9ru, 2016-06-22 00:35:39

How to find text in editText?

I need to find the $ sign in editText.
"equals" doesn't help as it compares the entire string.

if (editText.getText().toString().equals("$"))
#code

In other words, you need a condition that checks whether the string contains "$".

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
IceJOKER, 2016-06-22
@m9ru

trycontains()

if (editText.getText().toString().contains("$")){
  Log.i("MYTAG", "Yep, there is it");
}

ps I really hope the name of the EditText variable is different , and not stupidly editText , give good names. www.oracle.com/technetwork/java/codeconventions-13...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question