*res/raw and the Assets the same point:
1. the files in both directories will be stored intact in the apk package after packaging , and will not be compiled into binary.
different points of *res/raw and assets :
1.res/rawwill be mapped to the file in theR.javafiles, use resources directly when accessingIDthatR.id.filename;Assetsfiles under the folder are not mapped toR.javaduring the visit, you need toAssetmanagerclass.
2.Res/rawthere can be no directory structure, andAssetsYou can have a directory structure, which isAssetsfolder can be created under directory
* To read a file resource:
1. read The file resource under the Res/raw, and get the input stream for write operation in the following way
· InputStream is =getresources (). Openrawresource (R.id.filename);
2. read The file resource under the assets, and get the input stream for write operation in the following way
· Assetmanager am = null;
· am = getassets ();
· InputStream is = Am.open ("filename");
Note 1 : Google's Android system processing assert has a bug, in the Assertmanager can not process a single more than 1MB files, or will be reported abnormal, raw without this limit can put a 4MB Mp3 file no problem.
Note 2 :Assets folder is a native file that is not compiled and processed, that is, the files inside the folder will not be like XML, Java files are precompiled, can be stored in some pictures, Html,js, CSS and other files.
The difference between asset and Raw in Android