Android will be forced to shut down. NullPointerException: Attempt to invoke virtual method 'void android.widget.TextView.setText(java.lang.CharSequence)' on a null object reference

Asked 2 years ago, Updated 2 years ago, 112 views

When you run Android and log in, the map screen appears, and it is forced to end immediately after the screen appears. Can anyone tell me what the problem is because I don't know how to watch logcat?


06-15 06:26:14.721 7895-7895/com.ossw.taxiapp E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.ossw.taxiapp, PID: 7895
    java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.TextView.setText(java.lang.CharSequence)' on a null object reference
        at com.ossw.taxiapp.DriverMapActivity$5.onDataChange(DriverMapActivity.java:212)
        at com.google.firebase.database.Query$1.onDataChange(com.google.firebase:firebase-database@@19.3.0:179)
        at com.google.firebase.database.core.ValueEventRegistration.fireEvent(com.google.firebase:firebase-database@@19.3.0:75)
        at com.google.firebase.database.core.view.DataEvent.fire(com.google.firebase:firebase-database@@19.3.0:63)
        at com.google.firebase.database.core.view.EventRaiser$1.run(com.google.firebase:firebase-database@@19.3.0:55)
        at android.os.Handler.handleCallback(Handler.java:739)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:135)
        at android.app.ActivityThread.main(ActivityThread.java:5221)
        at java.lang.reflect.Method.invoke(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:372)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)

android java xml android-studio nullpointerexception

2022-09-20 21:57

1 Answers

The TextView you are trying to refer to is null.


2022-09-20 21:57

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.