【发布时间】:2019-11-22 01:25:30
【问题描述】:
我想用颤振项目在列表视图中显示所有歌曲,但我不知道如何访问我的内部文件夹。
首先 我刚刚创建了一个名为“Shruti”的文件夹,但它是在 /storage/emulated/0/Android/data/com.example.musicplayer/files 中创建的,但我只想在 /storage/emulated/0/ 中创建该文件夹路径。
因为我不知道如何读写内部和外部存储。
final directory = await getApplicationDocumentsDirectory();
print('Directory= $directory');
// External storage directory: /storage/emulated/0
Directory externalDirectory = await getExternalStorageDirectory();
print('External Storage:$externalDirectory ');
new Directory(externalDirectory.path+'/'+'Shruti').create(recursive: true)
.then((Directory directory) {
print('Path of New Dir: '+directory.path);
});
【问题讨论】:
-
请显示一些代码,到目前为止你已经尝试过什么。
-
与此类似:stackoverflow.com/questions/49399958/… 但将 pdf 替换为 mp3。
-
完成,你可以检查我的代码。