May someone help me with this?

http://stackoverflow.com/questions/10576173/onchildviewremoved-triggered-only-by-the-last-child

I got this listener code, but the onChildViewRemoved is only triggered
when the last child is removed. The onChildViewAdded is triggered on
every child added. (that's what I expected for both)

My goal is to limit the ListView in 9 items, when the limit is reached
I want to hide the form and after that, when I remove an item, I want
the form back.

private OnHierarchyChangeListener grdCategoriesHieararchyChangeHandler
= new OnHierarchyChangeListener() {
@Override
public void onChildViewRemoved(View parent, View child) {
    LinearLayout bc = (LinearLayout)findViewById(R.id.newCategory);
    if (bc.getVisibility() == View.INVISIBLE)
        bc.setVisibility(View.VISIBLE);
}

@Override
public void onChildViewAdded(View parent, View child) {
    if (mCategories.getCount() >= 9)
    {
        LinearLayout bc =
(LinearLayout)findViewById(R.id.newCategory);
        bc.setVisibility(View.INVISIBLE);
    }
}
};

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to