mercredi 3 février 2016

SQLite to ExpandableLIstView using custom adapter

I want to show expandable listview in my app. I have stored data in sqlite in tw table Main_Categories and Sub_Categories. Main_categories has 3 columns (Id, Name, Remote_id) and Sub_categoris has 4 columns (Id, Name, Remote_id, Parent_category_id).

For example:

Main_Categories tabel:
ID | Name    | Remote_id
 1 | Drinks  | 335
 2 | Bags    | 340


Sub _Categories table
ID | Name      | Remote_id | Parent_categories_id
1  | pepsi     | 336       | 335
2  | Fenta     | 338       | 335
3  | Coke      | 339       | 335
4  | paperbags | 341       | 340
5  | Plasticbag| 342       | 340

So, i want to show my ExpandableListView Like this :

Drinks
 - pepsi
 - Fenta
 - Coke'
Bags
 - paperbags
 - plasticbag

P.S :I have almost 20+ Main categories and 50+ their sub categoris. Thanks.

Aucun commentaire:

Enregistrer un commentaire