Extending the data service
Since we have decided to use an external camera app to capture the picture, it will take care of saving the picture after it has been captured. We will have to provide the storage path where the image will be saved. To save the POI images, we will use a naming scheme such as poiimage<poi id>.jpg
.
Let's now extend the POIService
class with the following additional methods.
Implementing GetFileName()
Let's implement the GetFileName()
method in POIService.cs
that will take care of providing the absolute path for saving the images in device memory. The absolute path includes the location and the filename. The image files will be named as poiimage<poi id>.jpg
. The following listing shows how the filename can be constructed:
public static string GetFileName (int poiId) { String storagePath = System.IO.Path.Combine (Android.OS.Environment.ExternalStorageDirectory.Path, "POIApp"); String path = System.IO.Path.Combine (storagePath, "poiimage" + poiId + ".jpg...