Differences between the assets folder and res folder in the Android project file

Source: Internet
Author: User

Differences between the assets folder and res folder in the Android project file

1. assets: Not in R. the corresponding tag is generated in the java file. You can create a folder in the assets folder. You must use the AssetsManager class to access the folder. The resources stored here will be included in the program installation package when running the package,

** 2. res. generate a tag under the java file. The resources here will judge which are used when the package operation is run, and the unused file resources will not be packaged into the installation package.
Res/raw and assets folders are used to store files that do not need to be compiled into binary files, such as font files **

** You can also define the directory in the res Folder:
Res/anim: animation resources are stored here.
Res/xml: You can use getResource (). getXML () to read the resource files in the Activity.
Res/raw: files in this directory can be directly copied to the device without subfolders. During software compilation, the data here does not need to be compiled and is directly added to the program installation package, the usage is getResource (). openRawResources (ID), where the parameter ID is in the form of R. raw. XXX. **

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.