简体   繁体   English

如何在Xamarin项目中的安装中将文本文件存储在Android目录中?

[英]How do I store text files in the Android Directory on Installation in a Xamarin Project?

I have a bunch of resource text files that I don't want to embed in my Xamarin Project. 我有一堆我不想嵌入到我的Xamarin项目中的资源文本文件。 When I install my app I want to text files to be transferred to the phones android directory at 当我安装我的应用程序时,我想将文本文件传输到位于以下位置的手机android目录中

data/data/$ProjectName/files

Which is the FileSystem's LocalStorage. 这是文件系统的LocalStorage。 How do I set up my Xamarin project to do this? 如何设置我的Xamarin项目来做到这一点?

Currently I put all of the files in a folder and set the files to CopyAlways, and when I build they go into the project's Debug Folder. 目前,我将所有文件放在一个文件夹中,并将文件设置为CopyAlways,在构建时将它们放入项目的Debug文件夹中。 But when I run the project on my phone, nothing is showing up in the localstorage folder. 但是,当我在手机上运行该项目时,localstorage文件夹中没有任何显示。 My Xamarin project is PCL and I am exporting to an Android Phone with SDK 23. 我的Xamarin项目是PCL,我正在导出到带有SDK 23的Android手机。

Deploy them as Android Assets instead. 而是将它们部署为Android Assets Then your app can either read them directly from Assets, or can copy them to local storage. 然后,您的应用程序可以直接从Assets中读取它们,也可以将它们复制到本地存储中。 Your app has to explicitly write things to local storage - there is no automated build action that will do this for you. 您的应用必须将内容明确地写入本地存储-没有自动的构建操作可以为您完成此操作。

暂无
暂无

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

相关问题 如何在 Xamarin for Android 中压缩文件? - How do I zip files in Xamarin for Android? 如何更改Xamarin项目的Android主题? - How do I to change the Android Theme of a Xamarin project? 如何在跨平台 xamarin 项目的主要解决方案中创建 Android 项目 PageRenderer class 的 object? - How do I create an object of an Android Project PageRenderer class in my main solution in a cross platform xamarin project? 如何使用Xamarin Android将文件存储在zip / rar存档中? - How to store files in zip / rar archive with Xamarin Android? 使用Xamarin,如何将.csv文件上的数据存储到本地android存储? - Using Xamarin, how do I store data on a .csv file to local android storage? 如何在 Xamarin.Z6421A86425CA3E88A39 内部的 Android.Widget.EditText 上实现 Android.Text.ISpannable? - How do I implement Android.Text.ISpannable on a Android.Widget.EditText inside of Xamarin.Forms? 我如何使用PCL项目在Xamarin中为Android和iOS开发应用程序? - How do i Use a PCL project to develop an app for Android and iOS in Xamarin? 如何在android项目属性中启用调试(Xamarin Android) - How can i enable debug in android project properties (Xamarin Android) 如何使用 Xamarin (Android) 获取用户设备中所有音频文件的数据? - How do I get data about all audio files in the user's device using Xamarin (Android)? 在 Xamarin Android 上的哪里存储 NLog 日志文件? - Where to store NLog log files on Xamarin Android?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM