mardi 21 juillet 2015

populating Expandable list view from the data in the sqlite ?

I Want to populate the Expandable Listview from the data stored in the sqlite database. Now iam getting all the headers for expandable listview but now how to add the childs to the expandable listview

 String retq="SELECT * FROM Sites";
            dataBase=openOrCreateDatabase("SYSTECH_home.DB", MODE_PRIVATE, null);
            Cursor c=dataBase.rawQuery(retq, null);
            if (c != null ) 
            {   listDataHeader = new ArrayList<String>();
                listDataChild = new HashMap<String, List<String>>();
                List<String> top250 = new ArrayList<String>();

                if  (c.moveToFirst()) 
                {


            do
            {   
                 id=c.getString(0);
                 site=c.getString(1);
                 name=c.getString(2);

                 listDataHeader.add(c.getString(1));



                    top250.add(name);
                    listDataChild.put(listDataHeader.get(0),top250 );


                //Toast.makeText(getActivity(), Activity+Start_Time+End_Time+Remarks, Toast.LENGTH_SHORT).show();

            }while(c.moveToNext());

            }
            }
            //c.close();
            dataBase.close(); 

the chlids are not fixed so, please help me.

Aucun commentaire:

Enregistrer un commentaire