xamarin - Android - NullReferenceException on Scroll/Drag-and-Drop (setDragFocus) -
i'm working on android app using xamarin.android (c#).
i have developed drag-and-drop autoscroll listview, seen in gist.
it works amazingly well, sometimes, sometimes, crashes , leaves no clue why. exception thrown "in unmanaged code" , useful information debugger shows stacktrace:
--- end of managed java.lang.nullpointerexception stack trace --- java.lang.nullpointerexception: attempt invoke virtual method 'void android.view.viewrootimpl.setdragfocus(android.view.view)' on null object reference @ android.view.viewgroup.dispatchdragevent(viewgroup.java:1454) @ android.view.viewgroup.dispatchdragevent(viewgroup.java:1482) @ android.view.viewgroup.dispatchdragevent(viewgroup.java:1482) @ android.view.viewgroup.dispatchdragevent(viewgroup.java:1482) @ android.view.viewgroup.dispatchdragevent(viewgroup.java:1482) @ android.view.viewgroup.dispatchdragevent(viewgroup.java:1482) @ android.view.viewgroup.dispatchdragevent(viewgroup.java:1482) @ android.view.viewgroup.dispatchdragevent(viewgroup.java:1482) @ android.view.viewgroup.dispatchdragevent(viewgroup.java:1482) @ android.view.viewgroup.dispatchdragevent(viewgroup.java:1482) @ android.view.viewgroup.dispatchdragevent(viewgroup.java:1482) @ android.view.viewgroup.dispatchdragevent(viewgroup.java:1482) @ android.view.viewgroup.dispatchdragevent(viewgroup.java:1482) @ android.view.viewrootimpl.handledragevent(viewrootimpl.java:5337) @ android.view.viewrootimpl.access$600(viewrootimpl.java:108) @ android.view.viewrootimpl$viewroothandler.handlemessage(viewrootimpl.java:3464) @ android.os.handler.dispatchmessage(handler.java:102) @ android.os.looper.loop(looper.java:152) @ android.app.activitythread.main(activitythread.java:5497) @ java.lang.reflect.method.invoke(native method) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:726) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:616)
i don't suspect can tell me why happening, maybe, there way @ least debug properly?
nowhere, not in log, fault in application, crashes. boom , gone.
the error have null object reference. check object generate problem , watch correctly instantiated.
example
//this object null object mymethod(some) //this object not null object = new object() mymethod(some)
Comments
Post a Comment