0
我试图在AsycTask的内部存储器中下载视频。我的代码工作正常。我的日志表示视频已下载。但是,我无法找到该文件夹,也没有在我的手机文件。无法在内部存储器中存储视频文件Android
这里是我的代码:
String nameoffile = mInfo.getFilename() + "." + mInfo.getFileType();
File rootdirectory= cw.getFilesDir().getAbsoluteFile();
if (!rootdirectory.exists()) {
rootdirectory.mkdirs();
}
File file = new File(rootdirectory, nameoffile);
file.createNewFile();
Log.e("DEVICE", "file created");
Log.e("DEVICE", "" + nameoffile);
InputStream input = new BufferedInputStream(url.openStream(), 8192);
OutputStream output = new FileOutputStream(file);
byte data[] = new byte[1024];
long total = 0;
while ((count = input.read(data)) != -1) {
total += count;
progress = (int) ((total * 100)/lenghtOfFile);
publishProgress(progress);
Log.e("PROGRESS", "" + mInfo.getFileType() + progress);
mInfo.setFilePercent(progress);
output.write(data, 0, count);
i = 1;
}
Log.e("Download Complete", "" + Mvalue);
// flushing output
output.flush();
// closing streams
output.close();
input.close();
Log.e("Download Complete", "" + 0);