3

While showing/dismissing alert dialog from my BottomSheetDialogFragment there is a blink on screen, How to avoid this? Thanks in advance.

AlertDialog alertDialog = AlertDialog.Builder(activity)
.setMessage(messageStringId)
.setPositiveButton(positiveButtonTextId) { _, _, _ ->
//Action
}
.setNegativeButton(negativeButtonTextId) { _, _, _ ->
//Action
}
.create()

alertDialog.show()

Issue: https://youtu.be/yR8XXgHchmA

1 Answers1

0

I guess there is something wrong in the way you added bottom sheet. I'm using BottomSheetDialogFragment and I don't see any blink as yours. Here is my code

class ItemListDialogFragment : BottomSheetDialogFragment() {
override fun onCreateView(
    inflater: LayoutInflater, container: ViewGroup?,
    savedInstanceState: Bundle?
): View? {
    return inflater.inflate(R.layout.fragment_item_list_dialog, container, false)
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
    show_dialog.setOnClickListener {
        AlertDialog.Builder(context!!)
            .setMessage("message")
            .setPositiveButton("ok", null)
            .setNegativeButton("cancel", null)
            .show()
    }
}
}
Brijesh Kumar
  • 1,685
  • 2
  • 17
  • 28