Just come back with a solution. My problem was actually forwarding the current getTag () fragment as the show () parameter for DialogFragment. If someone is interested here, then the sample works.
Create a simple listener
public interface OnCloseListDialogListener { public void onDialogListSelection(); }
Create a new dialog box that will expand the DialogFragment dialog box
public class ListDialogFragment extends DialogFragment implements DialogInterface.OnClickListener { private PersonaData[] mPersonaData; private String[] mPersonaName; private final String TAG; public static ListDialogFragment newInstance(PersonaData[] personaData, String tag) { ListDialogFragment dialog = new ListDialogFragment(personaData, tag); Bundle bundle = new Bundle(); dialog.setArguments(bundle); return dialog; } private ListDialogFragment(PersonaData[] personaData, String tag) { this.mPersonaData = personaData.clone(); this.TAG = tag; } @Override public void onCreate(Bundle bundle) { super.onCreate(bundle); setCancelable(true); int style = DialogFragment.STYLE_NORMAL, theme = 0; setStyle(style, theme); } @Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(R.string.dialog_title); mPersonaName = getData();
And then in the fragment from which you want to call this dialog box, do as shown below. DIALOG is just a String constant. I posted only a dialogue there
SOME_CLICKABLE.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { FragmentManager manager = getFragmentManager(); ListDialogFragment dialog = ListDialogFragment.newInstance(mPersona, getTag()); dialog.show(manager, DIALOG); } });
peter_budo
source share