【发布时间】:2013-04-11 14:21:46
【问题描述】:
我对这行代码有疑问。想在设备上创建 sqlite 数据库。
string dbPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal) + "\\test.db";
if (!System.IO.File.Exists(dbPath))
using (System.IO.Stream sr = ***Assets***.Open("test.db"))
{
using (System.IO.Stream srTo = System.IO.File.Create(dbPath))
{
sr.CopyTo(srTo);
}
}
此消息提供: 当前上下文中不存在名称“资产”
有一个类似的项目,但比大的更全面。没有错误。他们在我遵循定义的地方定义了 c 驱动器中的 cs 文件,提供了对 Android.Content.ContextWrapper 的引用。 不在项目路径上。 [文件如何被添加应用程序?
【问题讨论】:
-
你的代码在哪里?这是在活动中吗?
-
是的,它在 Activity 中
标签: android xamarin.android assets