我建立一个应用程序来转换纬度和经度 在各种格式之间。我的布局已完成,但我目前 挑战是这样的:

为度值,当用户输入在EditText1的值,我想 它在EditText2复制,因为它们是打字,实时,个性 字符。我必须战胜自己了试图OnTouchListener, onKeyboardActionListener等

后来,我将在分钟,秒执行计算,并 小数部分,因为它们是键入的,由于度视场不 不需要计算,我只是想复制用户的价值 跨多个的EditText框现在。

内容: 捕捉EditText1的人物,因为他们是有类型 地方EditText1捕获字符到EditText2的飞行。

任何帮助,将不胜感激。

麦克墨菲

有帮助吗?

解决方案

我没有测试,但是我发现addTextChangedListener():

EditText firstEditText = (EditText)findViewById(R.id.firstEditText);
firstEditText.addTextChangedListener(new TextWatcher(){
    public void afterTextChanged(Editable s){
        String c = s.toString(); // read Content
        ((EditText)findViewById(R.id.secondEditText)).setText(c); // copy to #2
    }
    public void beforeTextChanged(CharSequence s, int start, int count, int after){ }
    public void onTextChanged(CharSequence s, int start, int before, int count){ }
});

http://groups.google.com/组/机器人开发人员/ browse_thread /线程/ eba1a2ea7d3a2828?FWC = 1

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top