Reputation: 1705
I am facing a situation to calculate the free size of the currently selected primary memory(i.e external or external sdcard). All i have is the file path in app specific folder like below
"/root/extsdcard/Android/data/com.a.b/files/img0001.jpg";
or
"/root/ext/Android/data/com.a.b/files/img0001.jpg";
How i can get the path "/root/extsdcard/" or "/root/ext/" respectively from above shown paths?
Upvotes: 0
Views: 2598
Reputation: 898
Just mention "/" for root directory e.g. File
File f=new File("/");
String files[]= f.list();
Upvotes: 2