Android examples for App:Assets String
get Asset String from asset file
//package com.java2s; import java.io.InputStream; import android.content.Context; public class Main { public static String getAssetString(Context ctx, String asset) { InputStream is = null;//from w w w. j a v a 2 s. c om byte[] data = null; try { is = ctx.getAssets().open(asset); int length = is.available(); data = new byte[length]; is.read(data); } catch (Exception ex) { } finally { try { is.close(); } catch (Exception exe) { } } String xml = new String(data); return xml; } }