简体   繁体   English

如何在 Android 中以编程方式创建文件夹

[英]How to create a folder programmatically in Android

I wonder how you (C#)programmatically create a folder in the Assets Folder in Android.我想知道您(C#)如何以编程方式在 Android 的 Assets 文件夹中创建一个文件夹。 My project is called App1 so the folder I want to create is named: "imagefolder1"我的项目名为 App1,因此我要创建的文件夹名为:“imagefolder1”

The full path look like this: App1/Assets/imagefolder1完整路径如下所示:App1/Assets/imagefolder1

How can we create "imagefolder1" here?我们如何在这里创建“imagefolder1”? (Notice that I want to have many image folders in the Assets Folder. Please tell if this is the wrong place to have them) (请注意,我想在 Assets 文件夹中有许多图像文件夹。请告诉这是否是错误的位置)

I wonder how you (C#)programatically create a folder in the Assets Folder in Android我想知道你(C#)如何以编程方式在 Android 的 Assets 文件夹中创建一个文件夹

You cannot do this, in any programming language.你不能用任何编程语言来做到这一点。 Assets are not files on the device.资产不是设备上的文件。 They are packaged in the APK, and you cannot modify them, including creating directories.它们被打包在 APK 中,您无法修改它们,包括创建目录。

 var pathToNewFolder = Android.OS.Environment.ExternalStorageDirectory.AbsolutePath + "/Assets/imagefolder1"; Directory.CreateDirectory(pathToNewFolder);

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM