Answer the question
In order to leave comments, you need to log in
What does the error java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference mean?
Throws an error:
2020-05-09 17:07:02.001 19837-19837/com.hfad.weatherapp E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.hfad.weatherapp, PID: 19837
java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference
at org.json.JSONTokener.nextCleanInternal(JSONTokener.java:121)
at org.json.JSONTokener.nextValue(JSONTokener.java:98)
at org.json.JSONObject.(JSONObject.java:164)
at org.json.JSONObject.(JSONObject.java:181)
at com.hfad.weatherapp.MainActivity$DownloadWeatherTask.onPostExecute(MainActivity.java:83)
at com.hfad .weatherapp.MainActivity$DownloadWeatherTask.onPostExecute(MainActivity.java:47)
at android.os.AsyncTask.finish(AsyncTask.java:755)
at android.os.AsyncTask.access$900(AsyncTask.java:192)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:772)
at android .os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:7860)
at java.lang.reflect. Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1075)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question