事件处理的EditText的焦点 [英] Event for Handling the Focus of the EditText

查看:106
本文介绍了事件处理的EditText的焦点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以给我建议相关的重点无论如何,的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();
    }
   }
});

这篇关于事件处理的EditText的焦点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆