Code example for ListFragment

Methods: onListItemClick, getFragmentManager

0
            Log.v("MMR","OnLoadFinished: mAdapter is null");
    } 
 
    @Override 
    public void onListItemClick(final ListView list, final View view, final int position, final long id) {
        super.onListItemClick(list, view, position, id);
        openDrugDetails(id);
    } 
 
    void openDrugDetails(long id)
    { 
        FragmentTransaction ft = getFragmentManager().beginTransaction();
        Fragment prev = getFragmentManager().findFragmentByTag("dialog");
        if (prev != null) {
            ft.remove(prev);
        } 
        ft.addToBackStack(null);
 
        // Create and show the dialog. 
        DialogFragment newFragment = DrugDetailsFragment.newInstance(id);