Nested dialogs?
I was messing around with DialogPlus, and I came accoss this "issue". I'm not able to show a child dialog from parent dialog. Here's the code:
final ArrayAdapter<String> childAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, new String[]{"Nothing to do", "do nothing"});
final DialogPlus child = DialogPlus.newDialog(Settings.this)
.setInAnimation(R.anim.dialogin).setBackgroundColorResourceId(R.color.bg)
.setOutAnimation(R.anim.dialogout)
.setAdapter(childAdapter)
.create();
final ArrayAdapter<String> parentAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, new String[]{"Dismiss", "Show another dialog"});
final DialogPlus parent = DialogPlus.newDialog(Settings.this)
.setInAnimation(R.anim.dialogin).setBackgroundColorResourceId(R.color.bg)
.setOutAnimation(R.anim.dialogout)
.setAdapter(parentAdapter)
.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(DialogPlus dialog, Object item, View view, int position) {
switch (position) {
case 0:
dialog.dismiss();
break;
case 1:
child.show();
dialog.dismiss();
break;
}
Log.v("Issue", parentAdapter.getItem(position));
}
})
.create();
parent.show();
Logcat report of clicks: 08-16 02:56:16.702 28131-28131/net.darkion.test V/Issue﹕ Dismiss 08-16 02:56:20.980 28131-28131/net.darkion.test V/Issue﹕ Show another dialog
However, the second dialog is shown when child.show(); is added an OnDismissListener()
Sorry for late reply, I'm currently in vacation, I'll check this issue very soon.
Hi, i run into same problem. Debugging shows that both dialogs run into the show method correctly. Even if i do not dismiss the first dialog the second is not shown.
Also have this issue :)
Did any one solve the issue? Its 2016 and still I am facing same.
Trick, use delay for waiting last dialog dismissed
My code in Kotlin
menuLogout.setOnClickListener {
dialog.dismiss()
Handler().postDelayed({
// Your dialog here
}, 600)
}
menuLogout is list item inside first dialog
dialog is first dialog
Did any one solve the issue? with postDelayed it's working but, I need a solution without tricks thank you 👍 @ProyekRiad @orhanobut