I have an object of arrays and I am pushing it to an ArrayList like this:
static ArrayList<String> jsonResponse = new ArrayList<>();
//inside the method
strResp = response.body().string(); //the response I get from the server
jsonResponse.clear(); //clear the array first
jsonResponse.add(strResp);
Now from the other class, I am accessing it like this but I can't get it to print because it says NULL:
public class SecondClass extends ReactContextBaseJavaModule {
private FirstClass firstclass;
public void getLocks(Callback callback) {
System.out.println("Print object: " + firstclass.jsonResponse);
}
}
First question, is ArrayList a proper way of achieving what I want in this case?
Second question, why am I not able to print it in the other class?
I do not have any experience in Android/Java so I know this might sound like a dumb question to many of you but please try to understand!