Android EditText ScrollingMovementMethod导致Null指针异常

时间:2013-11-08 12:20:07

标签: android-edittext android-scrollview android-scroll android-scrollbar

在我的Edittext scrollView中滚动视图LinearLayout,有时edittext抛出异常,我不知道为什么会发生这种情况。任何人都有想法请帮助我。 感谢先进

这是我的代码:::

            edittext.setOnTouchListener(new ScrollView.OnTouchListener() {
                @Override
                public boolean onTouch(View v, MotionEvent event) {

                    try {
                        int action = event.getAction();
                            Log.e("action:",action+"");
                        switch (action) {
                        case MotionEvent.ACTION_DOWN:

                            // Disallow ScrollView to intercept touch events.
                            float iniY = event.getRawY();
                            v.getParent().getParent().getParent()
                                    .requestDisallowInterceptTouchEvent(true);
                            break;

                        case MotionEvent.ACTION_UP:
                            // Allow ScrollView to intercept touch events.
                            v.getParent().getParent()
                                    .requestDisallowInterceptTouchEvent(false);

                            break;
                        }
                    } catch (Exception e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                        Log.e("e", e.getMessage());
                    }
                    return false;
                }
            });

11-08 17:43:39.836:E / InputEventReceiver(10223):异常调度输入事件。     11-08 17:43:39.836:E / MessageQueue-JNI(10223):MessageQueue回调中的异常:handleReceiveCallback     11-08 17:43:39.851:E / MessageQueue-JNI(10223):java.lang.NullPointerException

0 个答案:

没有答案