一箫一剑平生意,负尽狂名十五年。这篇文章主要讲述c# 枚举安卓系统中所有目录及文件名相关的知识,希望能为你提供帮助。
using android.App; using Android.Widget; using Android.OS; using System.Runtime.InteropServices; namespace App2 { [Activity(Label = "App2", MainLauncher = true, Icon = "@drawable/icon")] public class MainActivity : Activity { [DllImport("TestDynamicSharedLib.so")] public extern static int getClickCount(); protected override void OnCreate(Bundle bundle) { var c = getClickCount(); //string folderPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.System); printAllSubFiles("/"); base.OnCreate(bundle); // Set our view from the "main" layout resource // SetContentView (Resource.Layout.Main); }void printAllSubFiles(string path) { System.Diagnostics.Debug.Print("dir:" + path); var dir = new System.IO.DirectoryInfo(path); try { foreach (var f in dir.GetFiles()) { System.Diagnostics.Debug.Print("file:" + f.FullName); } } catch { //throw; }try { foreach (var d in dir.GetDirectories()) { printAllSubFiles(d.FullName); } } catch (System.Exception) { //throw; }} } }
【c# 枚举安卓系统中所有目录及文件名】
推荐阅读
- Android 开发 上拉加载更多功能实现
- CreateFileMappingMapViewOfFile UnmapViewOfFile函数用法及示例
- 在Android浏览器中通过WebView调用相机拍照/选择文件 上传到服务器
- win7/10下Qt Creator调试提示(The selected debugger may be inappropriate for the inferior的解决办法)
- Android MVP 架构一 View与Presenter
- android中使用toolbar
- Spring Boot MyBatis注解(@MapperScan和@Mapper)
- 移动端车牌识别为优质app而存在
- 微信跳转外部浏览器下载app