Code example for ListFragment

Methods: getFragmentManager

0
 
    public void showDeleteDialog(long noteId) {
        // DialogFragment.show() will take care of adding the fragment 
        // in a transaction.  We also want to remove any currently showing 
        // dialog, so make our own transaction and take care of that here. 
        FragmentTransaction ft = getFragmentManager().beginTransaction();
        Fragment prev = getFragmentManager().findFragmentByTag("dialog");
        if (prev != null) {
            ft.remove(prev);
        } 
        ft.addToBackStack(null);
 
        // Create and show the dialog. 
        DialogFragment dialog = new DeleteNoteDialogFragment();
        dialog.show(getFragmentManager(), "dialog");
        this.noteId = noteId;
    } 
 
    // The dialog fragment receives a reference to this Activity through the 
    // Fragment.onAttach() callback, which it uses to call the following methods 
    // defined by the NoticeDialogFragment.NoticeDialogListener interface