Snackbar.make(findViewById(android.R.id.content),"Restart to update", Snackbar.LENGTH_INDEFINITE)
i want change this to alert dialog, need help
Snackbar.make(findViewById(android.R.id.content),"Restart to update", Snackbar.LENGTH_INDEFINITE)
i want change this to alert dialog, need help
 
    
     
    
    You can find the official documentation here
To implement an AlertDialog you need to use the AlertDialog.Builder class too setup the AlertDialog. Then you can use the .create() method to create the AlertDialog, and then finally .show() of AlertDialog class to show the dialog.
val alertDialog: AlertDialog? = activity?.let {
    val builder = AlertDialog.Builder(it)
    builder.apply {
        setMessage("This is the message")
        setTitle("This is the title")
        setPositiveButton(R.string.ok,
                DialogInterface.OnClickListener { dialog, id ->
                    // User clicked OK button
                })
        setNegativeButton(R.string.cancel,
                DialogInterface.OnClickListener { dialog, id ->
                    // User cancelled the dialog
                    // Use this to dismiss dialog
                    dialog.dismiss()
                })
    }
    // Set other dialog properties
    ...
    // Create the AlertDialog
    builder.create()
}
alertDialog.show()
You can use this to dismiss the dialog:
alertDialog.dismiss()
