第一种方法
String path = "file:///android_assert/文件名"
第二种方法
InputStream abPath = getClass().getResourceAsStream("asserts/文件名");
若想要转换成String类型:
String path = new String (InputStreamToByte(abpath));
private byte[] InputStreamToByte(InputStream is) throws IOException {
ByteArrayOutputStream bytesStream = new ByteArrayOutputStream();
int ch;
while ((ch = is.read()) != -1) {
byteStream.write(ch);
}
byte[] imgData = byteStream.toByteArray();
byteStream.close();
return imgData;
}