Download Uri to file
This commit is contained in:
@ -277,7 +277,7 @@ public class Transfer {
|
||||
return fileList;
|
||||
}
|
||||
|
||||
public void downloadFile(final Uri uri, String name, long fileSize, String href, Button button) throws IOException {
|
||||
public void downloadFile(final File file, String name, long fileSize, String href, Button button) throws IOException {
|
||||
|
||||
/*final LinearLayout layout = activity.findViewById(id);
|
||||
final Button button;
|
||||
@ -286,8 +286,6 @@ public class Transfer {
|
||||
else
|
||||
button = null;*/
|
||||
|
||||
final File file = new File(uri.getPath());
|
||||
|
||||
URL url = null;
|
||||
HttpURLConnection conn = null;
|
||||
int maxBufferSize = 1 * 1024 * 1024;
|
||||
|
@ -302,13 +302,13 @@ public class DownloadFragment extends Fragment {
|
||||
final String href = (String) layout.getTag(R.id.ID_FILE_HREF);
|
||||
|
||||
new File(save_location).mkdirs();
|
||||
Uri uri = Uri.fromFile(new File(save_location, name));
|
||||
File file = new File(save_location, name);
|
||||
|
||||
Transfer tr = new Transfer();
|
||||
|
||||
new Thread(() -> {
|
||||
try {
|
||||
tr.downloadFile(uri, name, fileSize, href, button);
|
||||
tr.downloadFile(file, name, fileSize, href, button);
|
||||
} catch (IOException e) {
|
||||
final String ExceptionName = e.getClass().getSimpleName();
|
||||
final String ExceptionMess = e.getMessage();
|
||||
|
Reference in New Issue
Block a user