我使用一个名为nexx的库,它是一个视频播放器。我有些崩溃取决于TouchListener
。我真的不知道怎么了。这是问题
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.setOnTouchListener(android.view.View$OnTouchListener)' on a null object reference
at com.awesome.app.video.NexxPlayerActivity.onPlayerError(Unknown Source:36)
at tv.nexx.android.player.NexxPlayerAndroidImpl.notifyError(Unknown Source:19)
at tv.nexx.android.player.NexxPlayerAndroidImpl.onPlayerLogicError(Unknown Source)
at tv.nexx.android.player.logic.PlayerLogicStateMachine.firePlayerLogicError(Unknown Source:24)
at tv.nexx.android.player.logic.PlayerLogicStateMachine.onMediaError(Unknown Source:16)
at tv.nexx.android.player.logic.PlayerLogic$2.onMediaError(Unknown Source:6)
at tv.nexx.android.player.logic.MediaManager$3.run(Unknown Source:23)
at tv.nexx.android.player.TransactionGetMedia$1.onFail(Unknown Source:16)
at tv.nexx.android.player.apiv3.APIManager$7$2.run(Unknown Source:6)
at android.os.Handler.handleCallback(Handler.java:808)
at android.os.Handler.dispatchMessage(Handler.java:101)
at android.os.Looper.loop(Looper.java:166)
at android.app.ActivityThread.main(ActivityThread.java:7425)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)
我仅使用OnTouchListener
这样:
@Override
public void onPlayerError(String reason, String details) {
Log.e(TAG, reason + " " + details);
this.root.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
finish();
return true;
}
});
this.root.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
}
这部分com.awesome.app.video.NexxPlayerActivity.onPlayerError(Unknown Source:36)
说它进入了这两个侦听器,但是出了什么问题呢?
答案 0 :(得分:0)
在某些情况下,当玩家抛出错误时,您的user_id
视图似乎为空。我真的不知道您实现了什么流程,但是您应该在设置create_at
之前检查它是否为this.root
并采取另一种措施,或者解决其原因null