开发者

Get text from an EditText

开发者 https://www.devze.com 2023-04-09 08:32 出处:网络
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?

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();
       }
   }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消