I have a JSONParser named class that finds all needed informations I need. I make an ArrayList variable and fill the data as it has to do. But... if I try to get this ArrayList from other activity, it does not give back any value...
public class JSONParser {
ArrayList<Day> days = new ArrayList<>();
public JSONParser() {
new getAllURLs().execute("https://...");
}
public ArrayList<Day> getDays() {
return days;
}
public void writeout() {
for (Day i : days) Log.e("Writeout", i.getDate());
}
}
For example if I call the writeout() function from a function that's also in this JSONParser class, it works perfectly, I get all the dates in Logcat as I have to. But if I try this in the main activity:
JSONParser jsonParser = new JSONParser();
jsonParser.writeout();
It does not do anything... Does not write anything in Logcat. If I type this
jsonParser.writeout();
In main activity, and a simple
writeout();
in the activity where I parsed the json files and I run the app when both is in the code, I get the dates only once...
Maybe anyone knows why is this?