i´m currently useing ResourceBundles in a pure Java program. Now I want to use the same files inside of an Android app. It works as intended, when the file is placed e.g. at /sdcard/. Is there a way to load them directly from the known android folder structure? e.g. from assets wihtout manually coping them to the sdcard?
This works at the sdcard:
File file = new File("/sdcard/");
URL[] urls = new URL[0];
try {
urls = new URL[]{file.toURI().toURL()};
} catch (MalformedURLException e) {
e.printStackTrace();
}
ClassLoader loader = new URLClassLoader(urls);
ResourceBundle rb = ResourceBundle.getBundle("test", Locale.DEFAULT, loader);
This url doesn´t work for the assests folder:
urls = new URL[]{new URL("file:///android_asset/test/")};
Thanks for any help.