Code example for DialogFragment

Methods: dismiss, getActivity, getArguments

0
      .setAdapter(mAdapter,this)
      .create();
  } 
  @Override 
  public void onClick(DialogInterface dialog, int which) {
    SelectFromCursorDialogListener activity = (SelectFromCursorDialogListener) getActivity();
    Bundle args = getArguments();
    args.putLong("result", ((AlertDialog) dialog).getListView().getItemIdAtPosition(which));
    activity.onItemSelected(args);
    dismiss();
  } 
  public void setCursor(Cursor c) {
    mAdapter.swapCursor(c);
  } 
}