List of utility methods to do Resource Get
Properties | getProperties(String name, Context context) Read a properties file from /assets. Resources resources = context.getResources(); AssetManager assetManager = resources.getAssets(); try { InputStream inputStream = assetManager.open(name); Properties properties = new Properties(); properties.load(inputStream); return properties; } catch (IOException e) { ... |
String[] | getStringArray(int arrayId) Get a string array by its ID in the resources. return resources.getStringArray(arrayId);
|
boolean | appendRes(StringBuilder sb, Resources res, int resId) append Res Reader reader = null; try { InputStream inputStream = res.openRawResource(resId); reader = new InputStreamReader(inputStream, "UTF-8"); char[] buffer = new char[inputStream.available()]; reader.read(buffer); sb.append(buffer); } catch (IOException e) { ... |