Process: com. Example. The weather, the PID: 3201
Java. Lang. RuntimeException: Unable to start the activity ComponentInfo {com. Example. The weather/com. Example. Weather. MainActivity} : Java. Lang. NullPointerException: Attempt to invoke interface method 'java.lang.object Java. Util. List. Get (int)' on a null Object reference
. An android app. ActivityThread. PerformLaunchActivity (ActivityThread. Java: 2416)
. An android app. ActivityThread. HandleLaunchActivity (ActivityThread. Java: 2476)
. An android app. ActivityThread. - wrap11 (ActivityThread. Java)
An android. App. ActivityThread $H.h andleMessage (ActivityThread. Java: 1344)
An android. OS. Handler. DispatchMessage (Handler. Java: 102)
. An android OS. Stars. Loop (148). Which Java:
. An android app. ActivityThread. Main (5417) ActivityThread. Java:
The at Java. Lang. Reflect. Method. Invoke (Native Method)
At com. Android. Internal. OS. $MethodAndArgsCaller ZygoteInit. Run (ZygoteInit. Java: 726)
At com. Android. Internal. OS. ZygoteInit. Main (ZygoteInit. Java: 616)
Under Caused by: Java. Lang. NullPointerException: Attempt to invoke interface method 'java.lang.object Java. Util. List. Get (int)' on a null Object reference
At com. Example. Weather. MainActivity. GetMap (MainActivity. Java: 58)
At com. Example. Weather. MainActivity. OnCreate (MainActivity. Java: 54)
. An android app. Activity. PerformCreate (6237) Activity. Java:
. An android app. Instrumentation. CallActivityOnCreate (1107) Instrumentation. Java:
. An android app. ActivityThread. PerformLaunchActivity (ActivityThread. Java: 2369)
. An android app. ActivityThread. HandleLaunchActivity (ActivityThread. Java: 2476)
. An android app. ActivityThread. - wrap11 (ActivityThread. Java)
An android. App. ActivityThread $H.h andleMessage (ActivityThread. Java: 1344)
An android. OS. Handler. DispatchMessage (Handler. Java: 102)
. An android OS. Stars. Loop (148). Which Java:
. An android app. ActivityThread. Main (5417) ActivityThread. Java:
The at Java. Lang. Reflect. Method. Invoke (Native Method)
At com. Android. Internal. OS. $MethodAndArgsCaller ZygoteInit. Run (ZygoteInit. Java: 726)
At com. Android. Internal. OS. ZygoteInit. Main (ZygoteInit. Java: 616)
CodePudding user response:
Java.lang.object Java. Util. List. Get (int) 'on a null Object referenceJava. Lang. NullPointerException check your List object under the null pointer exception for initialization
CodePudding user response:
New ArryList<> (a); Good, you want to use this collection without new List will report the error