Android get URL and URI from File

File myFile = new File(folderPath + "/" + filename);

//Getting URI
Uri uri = Uri.fromFile(myFile);

//Getting URL

URL url=null;
try {
    url = myFile.toURI().toURL();
} 
catch (MalformedURLException e) {
    e.printStackTrace();
}

 

Author: bm on August 17, 2016
Category: Android

Your comment:

Your Name

Comment:




Last articles