private void bindData() { // reference TreeViewList treeView = (TreeViewList) mRootView.findViewById(android.R.id.list); ViewGroup emptyView = (ViewGroup) mRootView.findViewById(android.R.id.empty); // treeview content if (mAdapter == null) { // create adapter mAdapter = new TreeListingAdapter( getActivity(), mProductList, mSelectedSet, mTreeStateManager, TREEVIEW_DEPTH); } else { // refresh adapter mAdapter.refresh(); mAdapter.notifyDataSetChanged(); } // set adapter treeView.setAdapter(mAdapter); // treeview parameters treeView.setCollapsible(true); treeView.setEmptyView(emptyView); treeView.setOnItemClickListener(this); // context menu registerForContextMenu(treeView); }
@Override public void onPause() { super.onPause(); // stop adapter if (mAdapter != null) mAdapter.stop(); }