Get text from an EditText
In my app I have an EditText that I w开发者_JAVA技巧ant to get the value out of when it looses focus. How should I do this?
Thanks!
Along the lines of this should work.
EditText.setOnFocusChangeListener(new View.OnFocusChangeListener()
{
@override
public void onFocusChange(View v, boolean hasFocus)
{
if (!hasFocus) {
string value = (EditText) v.getText().ToString();
}
}
}
精彩评论