第一种方法:
       String path = "file:///android_asset/文件名";

第二种方法
    InputStream abpath = getClass().getResourceAsStream("/assets/文件名");


若要想要转换成String类型

String path = new String(InputStreamToByte(abpath ));


private byte[] InputStreamToByte(InputStream is) throws IOException {
        ByteArrayOutputStream bytestream = new ByteArrayOutputStream();
        int ch;
        while ((ch = is.read()) != -1) {
            bytestream.write(ch);
        }
        byte imgdata[] = bytestream.toByteArray();
        bytestream.close();
        return imgdata;
}

相关文章:

  • 2022-02-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-26
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-11-30
  • 2021-11-27
  • 2021-08-10
  • 2022-01-10
  • 2021-09-04
相关资源
相似解决方案