Search code examples
xamarinxamarin.androidportable-class-libraryxamarin.forms

How to store the Local image path in sqlite or xml database in Xamrin.Forms


I have given task to store the image path in database either xml schema or sqlite database.I am working on Xamarin.Forms PCL project. I am very confused with how to store image path in database.because in android image should be placed in Ressource/drawble,ios image placed in Resources folder. I read this xamarin.forms documentaion. But not getting how to get path and store in database. Please anyone provide any resources or example.


Solution

  • Hope you have gone through this documentation and to distinguish between iOS and Android is also Given here in this documentation .

    if (Device.OS == TargetPlatform.iOS) {
        // Save in sqlite with iOS path
    }if (Device.OS == TargetPlatform.Android) {
        // Save in sqlite with Android path
    }
    

    Hope it helps.