dimanche 31 janvier 2016

Show my data to listview in Android

I am new android programmer and don't know many things about listview. By the way , I have two ArrayList of database entities;

first is country and properties are : Id , Name. second is city and properties are : Id , Name , CountryId

All data are stored in database (and coming from there and I put them in ArrayList such as ArrayList<City> and ArrayList<Country>).

I want to bind ArrayList<Country> to a listview and when user click on an item then show cities that are related to that country(By the Id of the Country).

so how to bind my ArrayList<Country> to listview that show the name , and store Id in any thing such as attribute of item of listview then when user click on item then I can fetch the Id and show ArrayList<City>.

Aucun commentaire:

Enregistrer un commentaire