vendredi 30 mai 2014

Custom ArrayList not showing proper output


Vote count:

0




I have arraylist that holds xml data.The xml data is loaded correctly but it not showing correct o/p on listview.The o/p is like com.example.questions.QuestionArrayList@b4dd8e30 My code is



public class Test extends Activity
{
private TextView question;
private RadioButton rdooption1;
private RadioButton rdooption2;
private RadioButton rdooption3;
private RadioButton rdooption4;
private static final String FILENAME = "xmlFileName.xml";
private FileInputStream fin;

QuestionArrayList currentquestion = null;
List<QuestionArrayList> questions = null;
private ListView details;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.question_layout);
details=(ListView)findViewById(R.id.listView1);
}
private void parseXML(XmlPullParser xpp) throws XmlPullParserException, IOException
{
questions= new ArrayList<QuestionArrayList>();
currentquestion = new QuestionArrayList();
while(xpp.next()!=XmlPullParser.END_DOCUMENT )
{
if (xpp.getEventType() != XmlPullParser.START_TAG)
{
continue;
}
String name = xpp.getName();
if(name.equals("Question"))
{
currentquestion.setQuestion_type(xpp.getAttributeValue(null, "id"));
currentquestion.setQuestion_type(xpp.getAttributeValue(null, "type"));
currentquestion.setQuestion_name(xpp.nextText());
}
if(currentquestion!=null)
{
questions.add(currentquestion);
}
}
ArrayAdapter<QuestionArrayList> arrayadpater = new ArrayAdapter<QuestionArrayList>(this,android.R.layout.simple_list_item_1,questions);
details.setAdapter(arrayadpater);
}
}


asked 42 secs ago






Aucun commentaire:

Enregistrer un commentaire