
Untitled
By: a guest on
May 7th, 2012 | syntax:
None | size: 0.56 KB | hits: 10 | expires: Never
Downloading files into a folder inside android application
directory = new File (Environment.getExternalStorageDirectory().toString() +"/data/"+getPackageName()+"/files");
directory.mkdirs();
if(DeleteFlag!=1 || !downloadTask.isCancelled()){
file1 = new File(directory, audioFileName);
output = new FileOutputStream(file1);
byte data[] = new byte[1024];
long total = 0;
while ((count = input.read(data)) != -1) {
total += count;
publishProgress(""+(int)((total*100)/lenghtOfFile));
output.write(data, 0, count);
}
}