How to deal with ExpandableList when all the data are coming from datebase?

by stonestrange » Sat, 06 Jun 2009 23:46:15 GMT


Sponsored Links
 I want to the effective like ExpandableList1 Activity in apidemo.But
my data is from the database.And th groups's data from the database
and the children's data from the database too.All both are comg from
different tables.
First,i want to konw how to get data from the cursor to String[];
Second,i want to konw how to confirm the data of children[][].

Thank you.
--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Help with contacts/numbers data to listView.

Does someone know how to get a 'flat' map / list of the contacts and 
there phone numbers. I am currently using this to build a datastructure, 
so I can display it in a lIstView, which is not really fast. The code 
shows that I do two queries. Would it be possible to do this with one 
query so that I end up with a just one cursor. The structure ideally 
would be:


contact name
number
number
contact name
number

This would then allow me with a custom listView Adapter to display the data and make the names non clickable. <code> public List<ContactInfo> getContacts(Context ctx) { // TODO Auto-generated method stub String[] projection = new String[] { Contacts.People._ID, Contacts.People.NAME, Contacts.People.NUMBER }; ContentResolver resolver = ctx.getContentResolver(); Cursor cur = resolver.query(Contacts.People.CONTENT_URI, null, null, null, Contacts.People.DEFAULT_SORT_ORDER); String name = "start_name_identitiy"; ArrayList<ContactInfo> contacts = new ArrayList<ContactInfo>(); if (cur.getCount() > 0) { while (cur.moveToNext()) { ContactInfo info = new ContactInfo(); String id = cur.getString(cur.getColumnIndex(People._ID)); String dname = cur.getString(cur.getColumnIndex(People.DISPLAY_NAME)); info.name = dname; Cursor pCur = resolver.query(Contacts.Phones.CONTENT_URI, null, Contacts.Phones.PERSON_ID + " = ?", new String[] { id }, null); int i = 0; int pCount = pCur.getCount(); String[] phoneNum = new String[pCount]; String[] phoneType = new String[pCount]; while (pCur.moveToNext()) { phoneNum[i] = pCur.getString(pCur.getColumnIndex(Contacts.Phones.NUMBER)); //phoneType[i] = pCur.getString(pCur.getColumnIndex(Contacts.Phones.TYPE)); if(phoneNum[i] != null) { // info.numbers.add( dname ); info.numbers.add( phoneNum[i] ); } i++; } if( info.numbers.size() > 0 ) contacts.add(info); } } return contacts; } <!code> Thank you. Jiri --

2. Android PDF library

Are there any android pdf libraries that are pretty well mature? ie
show images, etc? I am workig on an app that will basically allow
reading of PDFs and I wanted to check here to see if there is an
accepted means of doing this.

-- 

3. Creating a ListView and onListItemClick()

4. World War Tips n Trick

5. Layout with ScrollView and TextView

6. Infus Ratjun

7. Non-stretchable background images