Code example for Fragment

Methods: getActivity, getView

0
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;