*res/raw and assets the same point:
1. Files in both folders will be stored intact in the APK package after packaging, and will not be compiled into binary.
Different points of *res/raw and assets:
The files in the 1.res/raw are mapped to the R.java file. Use the resource ID, or r.id.filename, directly when visiting. Files in the assets directory are not mapped to R.java, and the Assetmanager class is required when visiting.
2.res/raw can not have a folder structure, while assets can have a folder structure. That is, you can create folders under the Assets folder
* Read File resources:
1. Read the file resources under the Res/raw, and get the input stream for write operation by the following way
- InputStream is = Getresources (). Openrawresource (R.id.filename);
2. (1) Read the file resources under assets. Get the input stream for write operations in the following way
- Assetmanager am = NULL ;
- am = Getassets ();
- InputStream is = Am.open ("filename");
(2) Suppose to play with Videoview:
Videoview.setvideouri (Uri.parse ("android.resource://" + getpackagename () + "/" + R.raw.movie));
Copyright notice: This article Bo Master original articles, blogs, without consent may not be reproduced.
Android Raw and assets resources