Using fragments for displaying POIDetails
In order to make things simple, we will move step by step. First, let's create a new fragment to display the details of the POI, and this will enable you to edit, update, and delete the POI. Currently, the POIDetailActivity
activity contains the same logic. At this point, let's keep it simple and not complicate things by thinking about the multi-pane tablet layout.
Creating the POIDetailsFragment layout
Let's begin with creating a new layout file for the POI details fragment and name it POIDetailFragment.axml
:
Select the
Resources/Layout
folder in the Solution pad.Right-click on Add and select New File.
In the New File dialog box, click on Android and select Layout, enter
POIDetailFragment
in the Name field, and select New.Note that we will not make any changes to the POI details screen layout. So, let's just copy the layout XML source code from
POIDetail.axml
and paste it into the newly createdPOIDetailFragment.axml
file.