Populating ExpandableListview from SQLitePopulating ExpandableListview from SQLite

Hi, I am using the code you create here http://androidexample.com/LISTVIEW/index.php?view=article_discriptdion&aid=107&aaid=129. It's working great so far, but I am having one issue getting the data to come from SQLlite just for the Parent and keep all the graphics the same. Do you have any sample code you can provide to do that. So far, I have create a databasehelper. Here is what I done so far. Thanks for your help. /** HELPER CODE ****************** * getting all saveNames into an ArrayList * */ public ArrayList getSaveNamesArrayList() { ArrayList saveNamesArrayList = new ArrayList(); String selectQuery = "SELECT * FROM " + TABLE_SAVENAMES; Log.e(LOG, selectQuery); SQLiteDatabase db = this.getReadableDatabase(); Cursor c = db.rawQuery(selectQuery, null); // looping through all rows and adding to list if (c.moveToFirst()) { do { saveNames td = new saveNames(); td.setId(c.getInt((c.getColumnIndex(KEY_ID)))); td.setLocationName((c.getString(c.getColumnIndex(KEY_NAME)))); td.setDateCreated(c.getString(c.getColumnIndex(KEY_DATECREATED))); // adding to saveNames list saveNamesArrayList.add(td); } while (c.moveToNext()); } return saveNamesArrayList; } ***** CALL TO HELPER CODE ***************** //Creating static data in arraylist final ArrayList dummyList = buildDummyData(); // Adding ArrayList data to ExpandableListView values //loadHosts(dummyList); } /** * here should come your data service implementation * * @return */ private ArrayList buildDummyData() { // Creating ArrayList of type parent class to store parent class objects ArrayListlist=new ArrayList(); //final ArrayList list = new ArrayList(); { db = new DatabaseHelper(getApplicationContext()); //ArrayListlist=new ArrayList(); list = db.getSavedNamesArrayList(); } return list; }

SUBMIT YOUR ANSWER

  |  
 
 
 

Preview :