当前位置:网站首页>Hongmeng reads the resource file

Hongmeng reads the resource file

2022-06-23 08:26:00 helwens

Read the external resource file in Hongmeng API by getRawFile

But the use of this method is somewhat strange

According to official documents :

Document center https://developer.harmonyos.com/cn/docs/documentation/doc-guides/basic-resource-file-example-0000001051733014#section126348226453 First, store the external resource files in resource/rawfile Inside

Only required for reading

this.getResourceManager().getRawFileEntry("resources/rawfile/models");

Can be read , This resources/rawfile Can't get rid of , Must be reserved to read

Once in use

this.getResourceManager().getRawFileEntry("models"); Unable to read file , That's why

However, there is another situation , Just to the back openrawfile Will go wrong

this.getResourceManager().getRawFileEntry("resources/rawfile/labels/labelmap”).openRawFile() Will report an error directly

java.io.FileNotFoundException: resources/rawfile/labels/labelmap

Change to “entry/resources/rawfile/labels/labelmap” add entry You can't report an error

So the insurance should have entry

原网站

版权声明
本文为[helwens]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/174/202206230806522168.html