- Forum posts: 4
Oct 5, 2015, 12:18:55 AM via Website
Oct 5, 2015 12:18:55 AM via Website
Guys
Having real problems with this Im a real beginner so please forgive if its obvious
I have my data that I want to usin in my list view as follow
Items[0]
Items[1]
Items[2]
Items[3]
It use a custom adapter to populate my list view as follows
Weather weather_data[] = new Weather[]
{
new Weather(R.drawable.b9, toppings[0],new Weather(R.drawable.b9, toppings[1][2],new Weather(R.drawable.b9,
toppings,new Weather(R.drawable.b9, toppings[3])
};
WeatherAdapter adapter = new WeatherAdapter(this,
R.layout.listview_item_row, weather_data);
listView1 = (ListView)findViewById(R.id.listView1);
View header = (View)getLayoutInflater().inflate(R.layout.listview_header_row, null);
listView1.addHeaderView(header);
listView1.setAdapter((ListAdapter) adapter);
this works fine and give me my 4 items on the listview
is there a way of populating the list view with a loop insead of using
new Weather(R.drawable.b9, toppings[0],new Weather(R.drawable.b9, toppings[1][2],new Weather(R.drawable.b9,
toppings,new Weather(R.drawable.b9, toppings[3])
so that it pulls the data from the string array?
I hope I have explained sufficiently and I appreciate any help
Mark