0

我尝试获取内部存储器文件或路径。但我做不到。下面的代码对我不起作用。

ContextWrapper cw = new ContextWrapper(getApplicationContext());
File directory = new File(cw.getFilesDir(), "Music");
directory.mkdirs();
File file = new File(directory, "aaa.mp3");
file.createNewFile();
file.mkdirs();

或者

File dir=Environment.getDownloadCacheDirectory();
dir.createNewFile();
dir.mkdirs();
File file = new File(dir, "aaa.mp3");
file.createNewFile();
file.mkdirs();

或者

File dir=Environment.getDataDirectory();
dir.createNewFile();
dir.mkdirs();
File file = new File(dir, "aaa.mp3");
file.createNewFile();
file.mkdirs();

请解释一下 getDirFiles()。我在相同的情况下读到 getDirFiles() 工作。但我不能使用它。

4

1 回答 1

0

Its a little late. If you have not find out the solution then just check my same issue conversation as yours .

Sometimes we write the perfect logic but still we face problem for some reasons.Like physical connection between device and compter which makes obstacle to fetch data from device.

于 2014-02-28T11:29:03.573 回答