How to get rid of the java error.lang.NullPointerException?

The bottom line is this
ArrayList<eventcalendar> event_calendar_list = null;
 for (int i = 0; i < tvSeries.size(); i++) {
System.out.println(tvSeries.get(i).getKinopoiskID());

 ArrayList<series> series = null;
 try {
 series = ld.loadMyMuviCalendar(tvSeries.get(i).getKinopoiskID().toString());
 } catch (IOException e) {
e.printStackTrace();
 } catch (JSONException e) {
e.printStackTrace();
}

 for (int ii = 0; ii < series.size(); ii++) {
 Ec EventCalendar = new EventCalendar();
ec.setDate(series.get(ii).getDate());
ec.setMuvi_obj(tvSeries.get(i));
ec.setSeri_obj(series.get(ii));
System.out.println(ec);
//
event_calendar_list.add(ec);
 }</series></eventcalendar>


The data all come and run through the array goes as it should, even can display these data in console but when trying to add them in event_calendar_list gives an error java.lang.NullPointerException
July 9th 19 at 11:05
2 answers
July 9th 19 at 11:07
uh so he's null
replace
ArrayList<eventcalendar> event_calendar_list = null;</eventcalendar>

on
ArrayList<eventcalendar> event_calendar_list = new ArrayList<eventcalendar> () ;</eventcalendar></eventcalendar>
Thank you didn't know ) - Tressie_Nader43 commented on July 9th 19 at 11:10
I thought he was just an empty create - Tressie_Nader43 commented on July 9th 19 at 11:13
only 3 weeks into java and haven't slept normally for a couple of months ) in between working ionic cordova study natelco ) I apologize for the stupid question - Tressie_Nader43 commented on July 9th 19 at 11:16
July 9th 19 at 11:09
As fully formulated question that it answer.
Yes, something really stupid ) I thought he was just an empty create - Tressie_Nader43 commented on July 9th 19 at 11:12

Find more questions by tags JavaAndroid