且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何获取原始文件夹android中的文件路径

更新时间:2023-01-30 17:13:48

资源是开发机器上的文件.它们不是设备上的文件.没有通往原始资源的路径.

Resources are files on your development machine. They are not files on the device. There is no path to your raw resource.

getResources().openRawResource(R.raw.zipfile) 很好,给你一个 InputStream.用它来读入你的资源内容.

getResources().openRawResource(R.raw.zipfile) is fine, to give you an InputStream. Use that to read in your resource contents.

而且,一般来说,在对象上调用 String.valueOf()toString() 是为了获取一些开发人员可读的字符串.InputStream 的字符串表示不会是文件系统路径.

And, in general, calling String.valueOf() or toString() on objects is for getting some developer-readable string. The string representation of an InputStream is not going to be a filesystem path.