Reputation: 1297
How do i do a if statement but i want like:
else if not edittext.getText.toString.contains("hello") then doCode.
and how do i setfocus on a component and remove the focus can not really figure that out.
Upvotes: 0
Views: 398
Reputation: 7330
To focus, you can try calling requestFocus()
on the View object: If editText is a TextView, try: editText.requestFocus()
http://developer.android.com/reference/android/view/View.html#requestFocus()
To remove focus, call editText.clearFocus()
http://developer.android.com/reference/android/view/View.html#clearFocus()
Upvotes: 1
Reputation: 3476
boolean editedText = edittext.getText().toString().contains("hello");
if (editedText == true) {
// do your code here
} else {
// do your code here
}
Upvotes: 0