How can I get relative path of the folders in my android project?


How can I get the relative path of the folders in my project using code?

I've created a new folder in my project and I want its relative path so no matter where the app is, the path will be correct.

I'm trying to do it in my class which extends

Perhaps something similar to "get file path from asset".

8/23/2014 9:05:52 PM

Make use of the classpath.

ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
URL url = classLoader.getResource("path/to/folder");
File file = new File(url.toURI());
// ...
4/23/2010 11:12:21 AM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow