Book Image

Xamarin Mobile Application Development for Android

Book Image

Xamarin Mobile Application Development for Android

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

Refreshing POIListActivity


Actions we take on POIDetailActivity, such as Save and Delete, have an effect on the data displayed in POIListActivity. We need to ensure that ListView in POIListActivity is refreshed and displays the updated POI list when it becomes active again. To achieve this, we have to depend on the activity life cycle callback methods.

As you may recall from Chapter 1, The Anatomy of an Android App, when an activity is moved to the background due to the start of a new activity, the OnPause() method is called. This would have happened for POIListActivity when POIDetailActivity was started. Once POIDetailActivity is completed by either calling the Finish() method or by pressing the device back button, the POIListActivity will be brought back to the foreground and the OnResume() method will be called.

Let's remove the call to DownloadPoisListAsync() in the OnCreate() method and add the following snippets to refresh POIListActivity:

protected override void OnResume (){
base.OnResume...