This is my JSON response and i'm storing that response into Model Class
 JsonObjectRequest jsonbObjReq_parents_Child = new JsonObjectRequest(Request.Method.GET, "http://qnabubackend-env.2fuz4eh5jh.ap-south-1.elasticbeanstalk.com/parent/api/get/childs/"+user_id, null,
            new Response.Listener<JSONObject>()
            {
                @Override
                public void onResponse(JSONObject response)
                {
                    try
                    {
                        Boolean error = response.getBoolean("error");
                        JSONArray jsonArray = response.getJSONArray("response");
                        int size = jsonArray.length();
                        Log.e("HEy>>>>",""+size);
                        for (int i=0;i<jsonArray.length();i++)
                        {
                            Log.e("H>>>>",""+size);
                            JSONObject jsonObject = jsonArray.getJSONObject(i);
                            DataSet dataSet = new DataSet();
                            dataSet.setStudentId(jsonObject.getInt("id"));
                            dataSet.setStudentFirstName(jsonObject.getString("studentFirstName"));
                            dataSet.setStudentLastName(jsonObject.getString("studentLastName"));
                            dataSet.setStudentclassId(jsonObject.getInt("classId"));
                            dataSet.setStudentCurClass(jsonObject.getInt("currentClass"));
                            dataSet.setStudentCurClassSec(jsonObject.getString("currentClassSection"));
                            dataSet.setStudentMobileNum(jsonObject.getLong("phoneNumber"));
                            dataSet.setStudentSchoolId(jsonObject.getInt("schoolId"));
                            dataSet.setSessionYear(jsonObject.getString("sessionYear"));
                            JSONArray jsonArray1 = jsonObject.getJSONArray("subjects");
                            List<DataSet.SubjectsList> subjectsLists = new ArrayList<>();
                            int j;
                            for (j=0;j<jsonArray1.length();j++)
                            {
                                JSONObject jsonObject1 = jsonArray1.getJSONObject(j);
                                DataSet.SubjectsList dataSubjects = new DataSet.SubjectsList();
                                dataSubjects.setSubjectId(jsonObject1.getInt("id"));
                                dataSubjects.setSubjectsName(jsonObject1.getString("name"));
                                subjectsLists.add(dataSubjects);
                            }
                            dataSet.setSubjectsLists(subjectsLists);
                            childData.add(dataSet);
                        }
childData is my arraylist which is generic i.e.: DataSet.
Now I want to access data Like schoolId,sessionYear in another activity.
public class AnnualActivity {
JsonObjectRequest jsonbObjReq_parents_Child = new JsonObjectRequest(Request.Method.GET, "http://qnabubackend-env.2fuz4eh5jh.ap-south-1.elasticbeanstalk.com/school/api/annual/activity/get/list?schoolId="+schoolID+"&session="+sessionYear, null,
}  
this is not the next activity so i cannot use INTENTS Concept.
If i Do like This Im getting NullPointerException in AnnualActivity Class
 private List sharedPref(List<DataSet> data)
    {
        for (int i=0;i<data.size();i++)
        {
            DataSet dataSet = data.get(i);
            int a = dataSet.getStudentSchoolId();
            String b = dataSet.getSessionYear();
            Log.e("grrf",""+a);
            Log.e("fasfc",b);
        }
        return data;
    }
 
     
     
     
    