事件处理的EditText的焦点事件、焦点、EditText

2023-09-12 08:41:03 作者:勋章○

任何人都可以给我建议相关的重点无论如何,的EditText ? 我的应用程序包含一个的EditText ,它接受一个URL在里面。

Can anyone suggest me any event related to the focus of the EditText? My application contains a EditText, which accepts a URL in it.

现在我的问题是,之后用户将在字段中输入URL和移动进一步的,没有任何的点击事件,即当焦点将从的EditText ,系统应检测所输入的地址,然后进到服务器

Now my problem is that, that after the user will enter the URL in the field and Move further, without any of the click event, i.e when the focus will move from the EditText, it should detect the entered Url and goes to the server.

如果我得到使用JSON解析的答复,那么它会更方便。

If I get the reply using Json Parsing, then it'll be more convenient.

感谢。

推荐答案

下面是焦点侦听器的例子。

Here is the focus listener example.

edit_Text.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
    if(hasFocus){
        Toast.makeText(getApplicationContext(), "got the focus", Toast.LENGTH_LONG).show();
    }else {
        Toast.makeText(getApplicationContext(), "lost the focus", Toast.LENGTH_LONG).show();
    }
   }
});