I want to display a dialog/popup window with a message to the user that shows "Are you sure you want to delete this entry?" with one button that says 'Delete'. When Delete
is touched, it should delete that entry, otherwise nothing.
I have written a click listener for those buttons, but how do I invoke a dialog or popup and its functionality?
Best Answer
You could use an
AlertDialog
for this and construct one using itsBuilder
class. The example below uses the default constructor that only takes in aContext
since the dialog will inherit the proper theme from the Context you pass in, but there's also a constructor that allows you to specify a specific theme resource as the second parameter if you desire to do so.