The difference between raw and asset in Android

Source: Internet
Author: User

Time: March 18, 2016 13:35:54
The same point: Files in two folders will not be compiled into binary files, will be left intact in the APK.

Different points:
    1. Files under asset are not mapped to r files, and the files under raw are mapped to r files.
    2. Because raw files can be mapped to r files, you can use the R.raw.xxx method to refer to resources.
    3. There can be a directory structure under asset, and no directory structure under RAW.


  • Since Raw is a subfolder of Resources (res), Android would automatically generate anIDFor any file located inside it. ThisIDIs and then stored aR class that would act as a reference to a file, meaning it can is easily accessed from the other Android classes and methods and Even in Android XML files. The Using the automatically generated ID is the fastest-to has access to a file in Android.

  • the Assets folder is An    Directory. The since You'll need to get a handle to it based on a String . However some operations is more easily do by placing files in this folder, like copying a database file to the system ' s Memory. There ' s no (easy)-to-Create an Android XML reference to files inside the Assets folder.


    Source:  http://stackoverflow.com/questions/9563373/ The-reason-for-assets-and-raw-resources-in-android


From for notes (Wiz)

The difference between raw and asset in Android

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.