Consider folowing code:
public class MediaItemAdapter extends BaseAdapter {
final List<Row> rows;
public MediaItemAdapter(Activity activity, ArrayList<HashMap<String, String>> data) {
Log.d("mediaadapter", "listcreation: " + data.size());
rows = new ArrayList<Row>();// member variable
int i=0;
for (HashMap<String, String> addvert:data) {
rows.add(new MeadiaRow((LayoutInflater) activity
.getSystemService(Context.LAYOUT_INFLATER_SERVICE), addvert));
Log.d("mediaadapter", addvert.get("title"));
if (i % 20 == 0) {
rows.add(new SourseRow((LayoutInflater) activity
.getSystemService(Context.LAYOUT_INFLATER_SERVICE)));
}
i++;
}
}
It is constructor of my adapter. After each 20 MediaRows, I wish to add one sourse row. It has ArrayList data
. The problem that data is always empty. I build my adapter according to this tutorial. In a tutorial thingth works fine. But in tutorial initial dataset is predefined. In my cade initial data set is empty and populates in working time. However, after I call notifyDataSetChanged
the data
remains empty (even though the dataset is not).
How can I get updated values for data?