Android: Convert path to File

2

How do I convert this path

  

/ storage / emulated / 0 / Download / images (10) .jpg

that is in String a File

    
asked by Javier fr 07.12.2016 в 22:41
source

2 answers

2

You can occupy the following:

Uri.fromFile(new File("/storage/emulated/0/Download/images(10).jpg")

or

File file = new File("/storage/emulated/0/Download/images(10).jpg");
    
answered by 07.12.2016 в 22:58
1

From the route:

String path = "/storage/emulated/0/Download/images (10).jpg"

You would create a file using the File class:

File f = new File(path);

The same for a database path:

 String path = "/storage/emulated/0//Android/data/com.mydblib/databases/test.db"
 File f = new File(path);
    
answered by 08.12.2016 в 23:17