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 android.app.Activity.
android.app.Activity
Perhaps something similar to "get file path from asset".
Make use of the classpath.
ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); URL url = classLoader.getResource("path/to/folder"); File file = new File(url.toURI()); // ...
1.4m articles
1.4m replys
5 comments
56.9k users