Skip to content

Instantly share code, notes, and snippets.

View rkhang7's full-sized avatar
✌️

Hoàng Xuân Khang rkhang7

✌️
View GitHub Profile
@PasanBhanu
PasanBhanu / AndroidDownloadImage.java
Created September 26, 2019 09:04
Download Image from URL and Added to Gallery - Android (Java)
/*
This method can be used to download an image from the internet using a url in Android. This use Android Download Manager to
download the file and added it to the Gallery. Downloaded image will be saved to "Pictures"
Folder in your internal storage
*/
private void downloadImageNew(String filename, String downloadUrlOfImage){
try{
DownloadManager dm = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
Uri downloadUri = Uri.parse(downloadUrlOfImage);