I am new to this one I need to parse json for Question and Answer Bank and set data in Custom ArrayList I unable to set the data using getter and setter.
My First Class
//Custom ArrayList
ArrayList<DataBO> dt=new ArrayList<DataBO>();
//Class With Getter Setter
public class DataBO
{
**public Questions[] Questions;**
public String PointsCanBeEarnedMsg;
public String ContentUrl;
public String getPointsCanBeEarnedMsg ()
{
return PointsCanBeEarnedMsg;
}
public void setPointsCanBeEarnedMsg (String PointsCanBeEarnedMsg)
{
this.PointsCanBeEarnedMsg = PointsCanBeEarnedMsg;
}
public String getContentUrl ()
{
return ContentUrl;
}
public void setContentUrl (String ContentUrl)
{
this.ContentUrl = ContentUrl;
}
public Questions[] getQuestions ()
{
return Questions;
}
public void setQuestions (Questions[] Questions)
{
this.Questions = Questions;
}
}
2nd Class for Question Array
public class Questions
{
public String CorrectOptionCount;
public String QuestionId;
public String QuestionString;
public String getCorrectOptionCount ()
{
return CorrectOptionCount;
}
public void setCorrectOptionCount (String CorrectOptionCount)
{
this.CorrectOptionCount = CorrectOptionCount;
}
public String getQuestionId ()
{
return QuestionId;
}
public void setQuestionId (String QuestionId)
{
this.QuestionId = QuestionId;
}
public String getQuestionString ()
{
return QuestionString;
}
public void setQuestionString (String QuestionString)
{
this.QuestionString = QuestionString;
}
public Options[] getOptions ()
{
return Options;
}
}
These
Questions [] qs=new Questions[len];
qs[i].setQuestionId(data);
are not working, getting NullPointer Exception??? How to add data in Questions after that in ArrayList??