简体   繁体   English

如何访问Xamarin Android环境。个人系统文件夹?

[英]How to access xamarin Android environment.personal system folder?

I am just working with sqlite DB. 我只是在使用sqlite DB。 My DB location is system.environmet.specialfolder.personal So how can access this folder 我的数据库位置是system.environmet.specialfolder.personal那么如何访问此文件夹

Here's how you can create a connection to an SQLite DB located in System.Environment.SpecialFolder.Personal : 这是创建与System.Environment.SpecialFolder.Personal的SQLite数据库的连接的方法:

public class SQLite_Android : ISQLite
{
    public SQLiteConnection GetConnection()
    {
        string documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
        var path = Path.Combine(documentsPath, "mySQLite.db"); // change mySQLite.db for your SQLite db filename
        // Create the connection
        var conn = new SQLiteConnection(path);
        // Return the database connection
        return conn;
    }
}

With

public interface ISQLite
{
    SQLiteConnection GetConnection();
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Windows中Xamarin.Android的System.Environment.SpecialFolder.MyDocuments的文件夹路径 - Folder path of System.Environment.SpecialFolder.MyDocuments of Xamarin.Android in windows 从android(Xamarin)System写入网络文件夹中。UnauthorizedAccessException - Write on a network folder from android (Xamarin) System.UnauthorizedAccessException Xamarin 社区工具包 CameraView - 在 Android 上访问 DCIM 文件夹 - Xamarin Community Toolkit CameraView - Access DCIM Folder on Android 访问 Xamarin Android 中的资产所需的完整项目文件夹路径 - Full project folder path necessary to access Assets in Xamarin Android Xamarin:Android:System.UnauthorizedAccessException:对路径的访问被拒绝 - Xamarin : Android : System.UnauthorizedAccessException: Access to the path is denied 如何从Xamarin中的android项目访问文件 - How to access a file from the android project in Xamarin Exception on Xamarin: System.ObjectDisposedException: Cannot access a disposed object 'Xamarin.Forms.Platform.Android.FastRenderers.LabelRenderer' - Exception on Xamarin: System.ObjectDisposedException: Cannot access a disposed object 'Xamarin.Forms.Platform.Android.FastRenderers.LabelRenderer' Xamarin iOS自定义文件夹访问 - Xamarin iOS Custom Folder Access 如何在xamarin.android中获取音乐文件夹路径? - How to get the music folder path in xamarin.android? 如何使用 xamarin 将照片保存在 android 的图库文件夹中 - how to save photo in gallery folder in android using xamarin
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM