Resources and Assets

Key classes

  1. Resources
  2. AssetManager

Resources are an integral part of an Android application. In general, these are external elements that you want to include and reference within your application, like images, audio, video, text strings, layouts, themes, etc. Every Android application contains a directory for resources (res/) and a directory for assets (assets/). Assets are used less often, because their applications are far fewer. You only need to save data as an asset when you need to read the raw bytes. The directories for resources and assets both reside at the top of an Android project tree, at the same level as your source code directory (src/).

리소스는 안드로이드 애플리케이션의 필수불가결한 부분이다. 일반적으로. 이것들은 여러분의 애플리케이션에서 포함시켜서 레퍼런스하고자 하는 이미지, 오디오, 비디오, 텍스트 문자열, 레이아웃, 테마 등과 같은 외부 요소들이다. 모든 안드로이드 애플리케이션은 리소스를 위한 디렉토리(res/)와 에셋을 위한 디렉토리(assets/)를 가진다. 에셋은 그것을 가지는 애플리케이션이 매우 적기 때문에 드물게 사용된다. 여러분이 원시 바이트bytes를 읽을 필요가 있을 때, 여러분은 에셋으로써 데이터를 저장할 필요가 있을 뿐이다. 리소스와 에셋에 대한 디렉토리 모두 여러분의 프로젝트 디렉토리의 최상위에, 여러분의 소스 코드 디렉토리와 나란히 존재한다.

The difference between "resources" and "assets" isn't much on the surface, but in general, you'll use resources to store your external content much more often than you'll use assets. The real difference is that anything placed in the resources directory will be easily accessible from your application from the R class, which is compiled by Android. Whereas, anything placed in the assets directory will maintain its raw file format and, in order to read it, you must use the AssetManager to read the file as a stream of bytes. So keeping files and data in resources (res/) makes them easily accessible.

“리소스resources”와 “에셋assets” 의 차이는 외관 상 많지 않다. 그러나 일반적으로 여러분은 외부 컨텐트를 저장하기 위해 에셋을 사용하기 보다는 리소스를 더 자주 사용할 것이다. 실제 차이는, 리소스 디렉토리에 놓인 어떤 것은 안드로이드에 의해 컴파일된 R 클래스를 통해, 애플리케이션에 의해 쉽게 접근 가능하다는 것이다. 에셋 디렉토리 안에 있는 모든 것은 원시 파일 포맷으로 유지될 것이며, 여러분은 그것을 읽기 위해 바이트 스트림으로 파일을 읽기 위한 에셋매니저AssetManager를 사용해야 한다. 그러므로 파일과 데이터를 리소스(res/)에 보관하는 것은 그것에 대한 접근을 용이하게 만든다.

Within the documents of this topic, you'll find information on the kinds of standard resources that are typically used in an Android application and how to reference them from you code. Resources and Internationalization is where you should start, to learn more about how Android utilizes project resources. Then, the Available Resource Types document offers a summary of various resource types and a reference to their specifications.

이 토픽의 문서에서, 여러분은 안드로이드 애플리케이션에서 일반적으로 사용되는 표준 리소스의 종류와 여러분의 코드에서 그것들을 레퍼런스하는 방법에 관한 정보를 찾을 수 있을 것이다. “리소스와 국제화Internationalization”는, 안드로이드가 프로젝트 리소스를 이용하는 방법에 대해 더 많이 공부하기 위한 시작점이다. 그런 다음에 “사용가능한 리소스 타입” 문서는 다양한 리소스 타입의 개요와 그것들의 스펙에 대한 레퍼런스를 제공한다.

↑ Go to top