0

在这里,我希望每当用户更改edittext的值然后textview的值也会随着使用量edittext的乘法而改变,但是每当我想在错误消息出现之前更改edittext值时,找不到源 - VeiwRootImpl.deliverInputEvent( ViewRoot$QueueInputEvent) 行:3125

我还放置了一些代码:-

edit_qty_regular_code.addTextChangedListener(new TextWatcher() {

        public void afterTextChanged(Editable s) {
            text_price_regular_code.setText (Integer.toString(qty));
        }

        public void beforeTextChanged(CharSequence s, int start, 
          int count, int after) {
            x=Integer.parseInt(text_price_regular_code.getText().toString());
        }

        public void onTextChanged(CharSequence s, int start, 
          int before, int count) 
        {
                qty=Integer.parseInt (edit_qty_regular_code.getText().toString());
                qty=(int) ((int)qty*(int)x);

        }
       }); 

Logcat 报告

10-13 14:06:26.359: I/System.out(664): waiting for debugger to settle...
10-13 14:06:26.559: I/System.out(664): debugger has settled (1478)
10-13 14:06:28.019: 
D/dalvikvm(664): GC_CONCURRENT freed 82K, 
3% free 8328K/8519K, paused 34ms+20ms, total 125ms
10-13 14:06:28.880: I/Choreographer(664): Skipped 61 frames!  
The application may be doing too much work on its main thread.
10-13 14:06:29.199: D/gralloc_goldfish(664): Emulator without GPU emulation detected.
10-13 14:06:32.689: I/Choreographer(664): Skipped 227 frames!  
The application may be doing too much work on its main thread.

但是如果我将这四行代码放在复选框勾选事件中,那么我没有遇到问题......请告诉我我在哪里做错了

4

0 回答 0