I am trying to open a dialog from listener of another dialog in service. But As soon as i dismiss first dialog nothing happen, not even a crash , neither the second dialog shows up
Asked
Active
Viewed 46 times
-2
-
3There's no technical reason to not be able to open one `Dialog` from the callback of another. Please [edit] your question to provide a [mcve] that demonstrates the issue. – Mike M. Nov 29 '19 at 08:31
-
Does this answer your question? [Display Android dialog on top of another?](https://stackoverflow.com/questions/8424757/display-android-dialog-on-top-of-another) – Daniel Nov 29 '19 at 10:34
1 Answers
0
Yes, it is possible to open dialog from another dialog, Use this code to open first dialog, here dialog_inventory_search file is first dialog layout file,
val dialog1 = Dialog(activity!!, R.style.my_dialog)
dialog1.requestWindowFeature(Window.FEATURE_NO_TITLE)
dialog1.setContentView(R.layout.dialog_inventory_search)
val btnSearch = dialog1.findViewById(R.id.btnSearch)
here is first dialog button click listener,
btnSearch .setOnClickListener {
val dialog2 = Dialog(activity!!, R.style.my_dialog)
dialog2.requestWindowFeature(Window.FEATURE_NO_TITLE)
dialog2.setCancelable(false)
dialog2.setContentView(R.layout.dialog_search)
dialog2.show()
}
dialog1.show()

Radhika Gami
- 91
- 4