我需要我和我的应用程序发现一个小问题,你的帮助。如何获取指定位置的URI?
在我的应用程序,我使用此代码的所有内容复制的资源文件夹中,我创建自己的文件夹。
File wallpaperDirectory = new File("/sdcard/Wallpaper/");
wallpaperDirectory.mkdirs();
AssetManager assetManager = getAssets();
String[] files = null;
try {
files = assetManager.list("");
} catch (IOException e) {
Log.e("tag", e.getMessage());
}
for(String filename : files) {
InputStream in = null;
OutputStream out = null;
try {
in = assetManager.open(filename);
out = new FileOutputStream("/sdcard/Wallpaper/" + filename);
copyFile(in, out);
in.close();
in = null;
out.flush();
out.close();
out = null;
} catch(Exception e) {
Log.e("tag", e.getMessage());
}
}
private void copyFile(InputStream in, OutputStream out) throws IOException {
byte[] buffer = new byte[1024];
int read;
while((read = in.read(buffer)) != -1){
out.write(buffer, 0, read);
}
}
现在我需要的“URI到这个文件夹(/ SD卡/壁纸/),我创建,当你?非常感谢你
我需要的“URI到文件夹,而不是包含在它特定的文件。因为根据我的想法,那么我必须随机使用游标来获取这个路径中的文件 – David