この水平リスト ビューを使用していますが、notify notifyDataSetChanged() Mainactivity クラスを呼び出してもビューが更新されません
oncreate{
products = new ArrayList<Product>();
listView = (HorizontalListView) findViewById(R.id.listView1);
imageAdapter = new ImageAdapter(this, products);
listView.setAdapter(new ImageAdapter(this, products));
...
private void loadProduct(Intent data) {
Bundle extras = data.getExtras();
Product p = (Product)extras.getParcelable(PASSED_PRODUCT);
//tried using imageAdapter.add(p) aswell but doesnt work either
products.add(p);
imageAdapter.notifyDataSetChanged();
..
ImageAdapter クラス
public void add(Product p) {
products.add(p);
// notify the list that the underlying model has changed
notifyDataSetChanged();
}
public void remove(int position) {
products.remove(position);
notifyDataSetChanged();
}
imageadapter クラス内のアイテムを削除するための buttonlistener がある場合、リストからアイテムを削除して適切に更新します