How to pass more than 1 array to ArrayAdapterView
I want to pass multiple arrays in adapter view in my project.
I did it like this:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ListView lv = getListView();
setListAdapter(new Ar开发者_StackOverflow中文版rayAdapter<String>(this, R.layout.main, COUNTRIES));
But I want to pass one more array, name as a people, is this possible?
if you pass the more than 1 value in adapter ...
1)create getter and setter method..for each item you pass...
ex:
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
2)create object for store data..
ex:
obj.setTitle("value");
3)create arrayList for store object....
ArrayList<News> arrList = new ArrayList<News>();
arrList.add(obj);
4)pass arraylist into custom adapter....
better way to pass more than one value...it's work..
精彩评论