Method deleteContact and DialogFragment confirmDelete
Method deleteContact
(Fig. 8.50, lines 193–197) displays a DialogFragment
(lines 200–252) asking the user to confirm that the currently displayed contact should be deleted. If so, the DialogFragment
uses an AsyncTask
to delete the contact from the database. If the user clicks the Delete Button
in the dialog, lines 222–223 create a new DatabaseConnector
. Lines 226–241 create an AsyncTask
that, when executed (line 244), passes a Long
value representing the contact’s row ID to the doInBackground
, which then deletes the contact. Line 232 calls the DatabaseConnector
’s deleteContact
method to perform the actual deletion. When the doInBackground
completes execution, line 239 calls the listener
’s ...
Get Android™ How to Program, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.