安卓:assets目录下的文本文件(不受R文件节制)
try { InputStream in = getAssets().open("testAsset.txt"); byte[] buffer = new byte[1024]; int len = 0; ByteArrayOutputStream baos = new ByteArrayOutputStream(); while ((len = in.read(buffer)) > 0) { baos.write(buffer, 0, len); } String str = new String(baos.toByteArray(), "GBK"); ZrLog.log(str); in.close(); } catch (IOException e) { e.printStackTrace(); }