Book Image

Xamarin Mobile Application Development for Android, Second Edition

Book Image

Xamarin Mobile Application Development for Android, Second Edition

Overview of this book

Table of Contents (18 chapters)
Xamarin Mobile Application Development for Android Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Populating user interface widgets


At this point, we have a reference to the PointOfInterest object, but we have not taken any action to populate the content on UI. Populating the POI details on UI is a pretty straightforward process.

The EditText widget has a property named Text, which we can set to initialize the content for the widget. Let's create a simple method named UpdateUI(), which takes care of populating the POI details on the user interface widgets.

The following listing shows what is needed for UpdateUI():

protected void UpdateUI()
{
     _nameEditText.Text = _poi.Name;
     _descrEditText.Text = _poi.Description;
     _addrEditText.Text = _poi.Address;
     _latEditText.Text = _poi.Latitude.ToString ();
     _longEditText.Text = _poi.Longitude.ToString ();
}

Call the UpdateUI() method at the end of the OnCreate() callback.

You should be able to run POIApp now, and test the navigation by clicking on any one of the list rows in POIListActivity. Notice that the POIDetailActivity will...