List of utility methods to do Asset Load
byte[] | loadAsset(Context context, String asset) load Asset byte[] buffer = null; try { InputStream is = context.getAssets().open(asset); int size = is.available(); buffer = new byte[size]; is.read(buffer); is.close(); } catch (IOException e) { ... |
JSONObject | loadJSONAsset(Context context, String asset) load JSON Asset String jsonString = new String(loadAsset(context, asset)); JSONObject jsonObject = null; try { jsonObject = new JSONObject(jsonString); } catch (JSONException e) { Log.e(TAG, "Failed to parse JSON asset " + asset + ": " + e); return jsonObject; ... |
InputStream | openXMLFile(String name, Context ctx) open XML File AssetManager assets = ctx.getAssets();
InputStream open = assets.open(name);
return open;
|