Code example for ExpandableListView

Methods: setOnItemClickListener, setEmptyView, setVisibility, startAnimation

-1
            return; 
        } 
        mListShown = shown;
        if (shown) {
            if (animate) {
                mList.startAnimation(AnimationUtils.loadAnimation(
                        getActivity(), android.R.anim.fade_in));
            } 
            mList.setVisibility(View.VISIBLE);
        } else { 
            if (animate) {
                mList.startAnimation(AnimationUtils.loadAnimation(
                        getActivity(), android.R.anim.fade_out));
            } 
            mList.setVisibility(View.GONE);
        } 
    } 
 
    /** 
     * Get the ListAdapter associated with this activity's ListView. 
     */ 
    public ExpandableListAdapter getExpandableListAdapter() {
        return mAdapter;
    } 
 
    private void ensureList() { 
        if (mList != null) {
            return; 
        } 
        View root = getView();
        if (root == null) {
            throw new IllegalStateException("Content view not yet created");
        } 
        if (root instanceof ExpandableListView) {
            mList = (ExpandableListView)root;
        } else { 
            mStandardEmptyView = (TextView)root.findViewById(INTERNAL_EMPTY_ID);
            if (mStandardEmptyView == null) {
                mEmptyView = root.findViewById(android.R.id.empty);
            } 
            View rawListView = root.findViewById(android.R.id.list);
            if (!(rawListView instanceof ExpandableListView)) {
                if (rawListView == null) {
                    throw new RuntimeException(
                            "Your content must have a ExpandableListView whose id attribute is " + 
                            "'android.R.id.list'"); 
                } 
                throw new RuntimeException(
                        "Content has view with id attribute 'android.R.id.list' " 
                        + "that is not a ExpandableListView class"); 
            } 
            mList = (ExpandableListView)rawListView;
            if (mEmptyView != null) {
                mList.setEmptyView(mEmptyView);
            } 
        } 
        mListShown = true;
        mList.setOnItemClickListener(mOnClickListener);
        if (mAdapter != null) {
            setListAdapter(mAdapter);
        } else { 
            // We are starting without an adapter, so assume we won't 
            // have our data right away and start with the progress indicator.