简体   繁体   中英

Attempt to invoke virtual method 'void android.widget.Editor$InsertionPointCursorController.show()' on a null object reference

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.Editor$InsertionPointCursorController.show()' on a null object reference
       at android.widget.Editor.performLongClick(Editor.java:1174)

       at android.widget.TextView.performLongClick(TextView.java:12717)

       at android.view.View.performLongClick(View.java:6954)

       at android.view.View$CheckForLongPress.run(View.java:26066)

       at android.os.Handler.handleCallback(Handler.java:789)

       at android.os.Handler.dispatchMessage(Handler.java:98)

       at android.os.Looper.loop(Looper.java:164)

       at android.app.ActivityThread.main(ActivityThread.java:6944)

       at java.lang.reflect.Method.invoke(Method.java)
       at 
com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)

       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)

any one help me about this crash.how I solved this.its reported on fabric again and again.

Some devices have thrown me that problem by keeping a long press on them when they do not have the focus

Add listener OnLongClick in each editable components of the layout

textView.setOnLongClickListener(new View.OnLongClickListener() {
    public boolean onLongClick(View v) {
        textView.requestFocus();
        return false;
    }
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM