F0RIS/sweet-alert-dialog

Confirm button warning type not work or not call

Closed this issue · 3 comments

Hey , I'm using kotlin for this library. When I want to click onConfirm clickListener , nothing happens.

                val pDialog = SweetAlertDialog(activity, SweetAlertDialog.WARNING_TYPE)

                pDialog.getProgressHelper().setBarColor(Color.parseColor("#A5DC86"))
                pDialog.setTitleText("Warning!")
                pDialog.setConfirmText("OK")
                pDialog.setContentText("For Recieving Menu of Restaurant Please Turn Your Bluetooth On")
                pDialog.setConfirmClickListener {
                    object:SweetAlertDialog.OnSweetClickListener{
                        override fun onClick(sweetAlertDialog: SweetAlertDialog?) {
                            Log.d("TAGG","enter click")
                            sweetAlertDialog!!.dismissWithAnimation()
                            val enableIntent = Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE)
                            startActivityForResult(enableIntent, 0)

                        }
                    }
                }
                pDialog.show()

Dialog is appeared but My OK click not work. I write a code for turning on Bluetooth , it does not work either. what am i wrong about?

F0RIS commented

I didn't test it with kotlin

I have used it on numerous occasions with kotlin and it works, your code though, why are you implementing another interface when you are already in one? SetConfirmClickListener is where you should put your logic for the onclick, and if I were you, I will put my intent before dismissing with animation

F0RIS commented

@NimaaZx
Did @chamellion's advices help you?