-
Book Overview & Buying
-
Table Of Contents
Xamarin Mobile Application Development for Android, Second Edition
By :
Notice that in the previous step, in the Adding Save and Delete action section, we are calling the SavePOI() and DeletePOI() actions from the OnOptionsItemSelected() method, but we haven't declared them at all. These two methods will deal with consuming web services to create, update, and delete the POI. The following sections will take you through both the SavePOI() and DeletePOI() actions.
Let's now declare a new method SavePOI() in the POIDetailActivity class. The SavePOI() method could avoid placing a lot of logic in the OnOptionsItemSelected() method. This method will validate the user input and initiate the server request to create or update the POI.
We will cover the field validation in an upcoming section and now focus on getting the user data from the screen and initiate a create/update request. The following listing shows what should be present in SavePOI():
protected void SavePOI()
{
_poi.Name = _nameEditText.Text;
_poi.Description = _descrEditText.Text...
Change the font size
Change margin width
Change background colour