Exception dispatching input event. Use xlistview

Source: Internet
Author: User

The bug solved this morning, one morning;

Log:

11-01 14:49:14.826: E/InputEventReceiver(30810): Exception dispatching input event.11-01 14:49:14.850: E/AndroidRuntime(30810): FATAL EXCEPTION: main11-01 14:49:14.850: E/AndroidRuntime(30810): java.lang.NullPointerException11-01 14:49:14.850: E/AndroidRuntime(30810): at android.widget.AbsListView.obtainView(AbsListView.java:2348)11-01 14:49:14.850: E/AndroidRuntime(30810): at android.widget.ListView.makeAndAddView(ListView.java:1845)11-01 14:49:14.850: E/AndroidRuntime(30810): at android.widget.ListView.fillDown(ListView.java:678)11-01 14:49:14.850: E/AndroidRuntime(30810): at android.widget.ListView.fillGap(ListView.java:642)11-01 14:49:14.850: E/AndroidRuntime(30810): at android.widget.AbsListView.trackMotionScroll(AbsListView.java:5602)11-01 14:49:14.850: E/AndroidRuntime(30810): at android.widget.AbsListView.scrollIfNeeded(AbsListView.java:3346)11-01 14:49:14.850: E/AndroidRuntime(30810): at android.widget.AbsListView.onTouchEvent(AbsListView.java:3699)11-01 14:49:14.850: E/AndroidRuntime(30810): at com.hades.newstyle.customviews.XListView.onTouchEvent(XListView.java:369)11-01 14:49:14.850: E/AndroidRuntime(30810): at android.view.View.dispatchTouchEvent(View.java:7347)11-01 14:49:14.850: E/AndroidRuntime(30810): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2352)11-01 14:49:14.850: E/AndroidRuntime(30810): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2049)11-01 14:49:14.850: E/AndroidRuntime(30810): at com.hades.newstyle.customviews.XListView.dispatchTouchEvent(XListView.java:303)11-01 14:49:14.850: E/AndroidRuntime(30810): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2358)11-01 14:49:14.850: E/AndroidRuntime(30810): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2063)11-01 14:49:14.850: E/AndroidRuntime(30810): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2358)11-01 14:49:14.850: E/AndroidRuntime(30810): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2063)11-01 14:49:14.850: E/AndroidRuntime(30810): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2358)11-01 14:49:14.850: E/AndroidRuntime(30810): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2063)11-01 14:49:14.850: E/AndroidRuntime(30810): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2358)11-01 14:49:14.850: E/AndroidRuntime(30810): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2063)11-01 14:49:14.850: E/AndroidRuntime(30810): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2358)11-01 14:49:14.850: E/AndroidRuntime(30810): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2063)11-01 14:49:14.850: E/AndroidRuntime(30810): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2358)11-01 14:49:14.850: E/AndroidRuntime(30810): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2063)11-01 14:49:14.850: E/AndroidRuntime(30810): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2358)11-01 14:49:14.850: E/AndroidRuntime(30810): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2063)11-01 14:49:14.850: E/AndroidRuntime(30810): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2064)11-01 14:49:14.850: E/AndroidRuntime(30810): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1513)11-01 14:49:14.850: E/AndroidRuntime(30810): at android.app.Activity.dispatchTouchEvent(Activity.java:2510)11-01 14:49:14.850: E/AndroidRuntime(30810): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2012)11-01 14:49:14.850: E/AndroidRuntime(30810): at android.view.View.dispatchPointerEvent(View.java:7527)11-01 14:49:14.850: E/AndroidRuntime(30810): at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3682)11-01 14:49:14.850: E/AndroidRuntime(30810): at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:3610)11-01 14:49:14.850: E/AndroidRuntime(30810): at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:4862)11-01 14:49:14.850: E/AndroidRuntime(30810): at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:4822)11-01 14:49:14.850: E/AndroidRuntime(30810): at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:4974)11-01 14:49:14.850: E/AndroidRuntime(30810): at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:179)11-01 14:49:14.850: E/AndroidRuntime(30810): at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method)11-01 14:49:14.850: E/AndroidRuntime(30810): at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:171)11-01 14:49:14.850: E/AndroidRuntime(30810): at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:4942)11-01 14:49:14.850: E/AndroidRuntime(30810): at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:4996)11-01 14:49:14.850: E/AndroidRuntime(30810): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:776)11-01 14:49:14.850: E/AndroidRuntime(30810): at android.view.Choreographer.doCallbacks(Choreographer.java:579)11-01 14:49:14.850: E/AndroidRuntime(30810): at android.view.Choreographer.doFrame(Choreographer.java:546)11-01 14:49:14.850: E/AndroidRuntime(30810): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:762)11-01 14:49:14.850: E/AndroidRuntime(30810): at android.os.Handler.handleCallback(Handler.java:725)11-01 14:49:14.850: E/AndroidRuntime(30810): at android.os.Handler.dispatchMessage(Handler.java:92)11-01 14:49:14.850: E/AndroidRuntime(30810): at android.os.Looper.loop(Looper.java:153)11-01 14:49:14.850: E/AndroidRuntime(30810): at android.app.ActivityThread.main(ActivityThread.java:5326)11-01 14:49:14.850: E/AndroidRuntime(30810): at java.lang.reflect.Method.invokeNative(Native Method)11-01 14:49:14.850: E/AndroidRuntime(30810): at java.lang.reflect.Method.invoke(Method.java:511)11-01 14:49:14.850: E/AndroidRuntime(30810): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:848)11-01 14:49:14.850: E/AndroidRuntime(30810): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:615)11-01 14:49:14.850: E/AndroidRuntime(30810): at dalvik.system.NativeStart.main(Native Method)


When running. The app will automatically collapse as soon as it slides.

At the beginning:

I always thought it was an issue of event distribution. I haven't found java. Lang. nullpointerexception in exception dispatching input event. After debugging for a long time. Where is it! I have no clue after looking for a morning.

After checking, when the getview () method in the listview adapter finds that convertview

The view is not assigned a value and the returned value is view.


Solution:

View view = convertview;

Code:


@ Overridepublic view getview (INT position, view convertview, viewgroup parent) {// todo needs to process the listview layout log for the new details. I ("love", "--- getcount () size =" + this. getcount (); // view = convertview; If (view = NULL) {view = Inflater. inflate (R. layout. fragment_new_fashtion_list_item, parent, false);} If (view! = NULL) {viewholder holder = (viewholder) view. gettag (); If (holder = NULL) {holder = new viewholder (); holder. newimageview = (imageview) view. findviewbyid (R. id. new_fashtion_item_image); holder. newtitleview = (textview) view. findviewbyid (R. id. new_fashtion_item_title); holder. newsharebtn = (radiobutton) view. findviewbyid (R. id. new_fashtion_rj_btn); holder. newcollectionbtn = (radiobutton) view. findviewbyid (R. id. new_fashtion_collection_btn); holder. newpricebtn = (radiobutton) view. findviewbyid (R. id. new_fashtion_price_btn); view. settag (holder);} // obtain the current data entity. Newstyleitementity entity = (newstyleitementity) newstylelists. get (position); log. I ("love", "--- position =" + position); log. I ("love", "--- entity =" + newstylelists. get (position ). getprice (); holder. newtitleview. settext (newstylelists. get (position ). gettitle (); holder. newpricebtn. append (newstylelists. get (position ). getprice (); // download the image:} return view ;}











Exception dispatching input event. Use xlistview

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.