问题
In my app I have an EditText that I want to get the value out of when it looses focus. How should I do this?
Thanks!
回答1:
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();
}
}
}
来源:https://stackoverflow.com/questions/7612069/get-text-from-an-edittext