Creating DeletePOI()

Like SavePOI(), the DeletePOI() method was created to simplify the logic in OnOptionsItemSelected(). Before deleting the POI, we must ask the user to reconfirm by showing a dialog. Later in this chapter, we will show you how to display a confirmation prompt before initiating the deleted request.

We created the CreateOrUpdatePOIAsync() method in POIDetailActivity, let's now add another new method named DeletePOIAsync(). This method performs pretty much the same task as the CreateOrUpdatePOIAsync() method does in POIDetailActivity. It checks for the Internet connection availability, initiates the delete operation asynchronously, and finally, notifies the user with a toast message.

Add the following DeletePOIAsync method to your ...

Get Xamarin Mobile Application Development for Android - 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.