android - Show DialogFragment from another DialogFragment -
hello have dialogfragment displays list of options user , 1 of these options "delete" option ,when user press delete option want show dialogfragment confirmation , unfortunately confirmation dialog doesnot show .
here code
first fragment code
public class contactdialogoption extends sherlockdialogfragment { public static final string tag = contactdialogoption.class.getsimplename(); public contactdialogoption() { super(); // todo auto-generated constructor stub } @override public dialog oncreatedialog(bundle savedinstancestate) { alertdialog.builder builder = new alertdialog.builder(getactivity()); builder.seticon(r.drawable.ic_launcher); builder.settitle(r.string.options); builder.setitems(new string[] { getstring(r.string.call), getstring(r.string.send_message), getstring(r.string.copy), getstring(r.string.edit), getstring(r.string.delete) }, new dialoginterface.onclicklistener() { @override public void onclick(dialoginterface dialog, int which) { if(which == 4) //delete { fragmentmanager mgr = getactivity().getsupportfragmentmanager(); fragmenttransaction ft = mgr.begintransaction(); fragment old = mgr.findfragmentbytag("secondfragment"); if (old != null) { ft.remove(old); } ft.addtobackstack(null); fragment.show(ft, fragmenttag); } } }); return builder.create(); } }
i got exact same problem, situation not happen when try open dialogfragment fragment.
the solution found modify following call:
fragment.show(ft, fragmenttag); to:
fragment.show(getfragmentmanager(), fragmenttag); the problem solution cannot work on fragmenttransition.
i don't understand why behavior different fragments.
Comments
Post a Comment