Code example for ListView

Methods: addHeaderViewsetAdapter, setEmptyView, setFocusable, setFocusableInTouchMode

0
 
        if (listViewId != 0) {
 
            listView = getListView();
            if (headerView() != null) { 
                listView.addHeaderView(headerView());
            } 
            // listView.setOnItemClickListener(this); 
            android.view.View emptyView = getActivity().findViewById(
                    android.R.id.empty);
            if (emptyView != null) {
                listView.setEmptyView(emptyView);
            } 
 
            view = Objects.createInstance(viewClass, Activity.class, getActivity());
            adapter = Objects.createInstance(adapterClass, Context.class, getActivity());
 
            listView.setAdapter(adapter);
            listView.setFocusable(true);
            listView.setFocusableInTouchMode(true);
        } 
 
        AnalyticsUtils.setContext(getActivity()); 
    }