What a difference there is between the Res folder and the Assets folder in Android

4

I wonder if assets and res are the same in Android, is that sometimes I find examples that refer to resources in assets and others in res, is messing me up a bit.

    
asked by Webserveis 14.04.2016 в 19:12
source

2 answers

5

These would be the most notable differences between /res and /assets :

/assets

  • Inside this folder are added files that, when the .apk package is generated, keep its name and characteristics.
  • Files with capitals or signs can be added which is not allowed within /res .
  • Inside this folder you can even create a file structure.

Example:

assets
 |__Directorio
 |__miBasedeDato
 |__ArchivosAndroid
  • The R class does not generate ids for the items stored in this folder
  • One important difference is that within / assets elements are added which can be read as a stream of bytes.

/res

  • Contains resources of the application such as layouts, images (drawables), strings, etc.
  • The main difference with respect to /assets is that these resources are accessed through class R, which is generated automatically by the project and contains ids that refer to each resource within /res .
  • Another difference is that within /res , only files with names containing lowercase characters from "a" to "z" and numeric characters from 0 to 9 are allowed.
answered by 14.04.2016 / 20:26
source
1

By experience, in Res are all the resources of Android that you can use or create them yourself, for example, animations, styles, extra layouts, etc. Already in the folder assets would go all the extra resources that you can use and that are not Android, for example sources and multimedia files. In my case, there I have placed videos, ogg files, sources, etc. Even files html and css .

    
answered by 14.04.2016 в 21:03