NullPointerException Attempt to invoke virtual method 'int android.widget....

java.lang.NullPointerException Attempt to invoke virtual method 'int android.widget.Editor on a null object reference android.widget.Editor.touchPositionIsInSelection(Editor.java:955) android.widget.Editor.touchPositionIsInSelection(Editor.java:901) android.widget.Editor.performLongClick(Editor.java:1002) android.widget.TextView.performLongClick(TextView.java:9261) android.view.View$CheckForLongPress.run(View.java:21151) android.os.Handler.handleCallback(Handler.java:742) android.os.Handler.dispatchMessage(Handler.java:95) android.os.Looper.loop(Looper.java:154) android.app.ActivityThread.main(ActivityThread.java:5523) java.lang.reflect.Method.invoke(Native Method) com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739) com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629)

这个错误NullPointerException Attempt to invoke virtual method 'int android.widget.Edito...粗心的你是不是遇到过,一般有两种情况,一种是代码写错,直接在启动activity的onCreate函数周期加载布局的时候会直接崩掉,肯定是布局的问题。另外一种就是没有发现问题,那就Clean下代码,因为编译器有时候在没有编译完全的时候也会出现这种问题。

发布了18 篇原创文章 · 获赞 8 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/github_36787585/article/details/82457152