码迷,mamicode.com
首页 > 其他好文 > 详细

Exception dispatching input event. use XlistView

时间:2015-09-15 18:08:41      阅读:197      评论:0      收藏:0      [点我收藏+]

标签:

今天上午解决Bug,一个上午的时间;

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: main
11-01 14:49:14.850: E/AndroidRuntime(30810): java.lang.NullPointerException
11-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)


跑的时候。

APP一 滑动 就自己主动崩掉。

開始的时候:

一直以为是事件分发的问题,Debug  了 好久也没有找到Exception dispatching input event. 中的 java.lang.NullPointerException,在哪里!

 找了一上午 也没有头绪。

        之后检查。ListView 适配器中的GetView() 方法的时候。发现,convertView

没有给view 赋值,并且返回的是 view.


       解决方式:

View view = convertView;

Code:


@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO 须要处理新款详情的 ListView布局
		
		Log.i("love", "---getCount()  size="+this.getCount());
		
		// 
		View 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_share_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);
			}
			
			// 获取当前的数据实体。
			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());
			
			//图片的下载:
			
			
			
		}
		
		return view;
	}











版权声明:本文博主原创文章,博客,未经同意不得转载。

Exception dispatching input event. use XlistView

标签:

原文地址:http://www.cnblogs.com/mengfanrong/p/4810836.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!