I am trying to iterate all child views of a listview including those that are off screen (invisible until scroll) but it only returns those that are onscreen (visible).
Button btnAddToCart = (Button) findViewById(R.id.btnAddToCart);
btnAddToCart.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
View view;
TextView tvProductBrand;
for (int i = 0; i < lv.getCount(); i++){
view = lv.getChildAt(i);
if(view != null)
{
tvProductBrand = (TextView) view.findViewById(R.id.tvProductBrand);
str_ItemBrand_from_lv = tvProductBrand.getText().toString();
Toast.makeText(getApplicationContext(), "lv_item: "+str_ItemBrand_from_lv, Toast.LENGTH_SHORT).show();
}
}
}
});
I know this view = lv.getChildAt(i);
only returns visible views only, how can I return all child views?
My listview adapter is lv_custom_adapter
(perhaps I need to use it instead but not sure how)?