assets_and_resources

Android Assets and Resources Management

Use the ResourceManager to retrieve resources from the res folder of your app Use the AssetManager to retrieve resources files from the assets folder of your app both are available from App If you write your own resources in your NIT project part of the application, you are obliged to set a string resource with the name "app_name" or it will be impossible for you to compile the apk correctly

Dependencies

dep_module_android__assets_and_resourcesdalvikdalvikioioassetsassetsassets_and_resourcesassets_and_resourcesassets->assets_and_resourcesassets_and_resources->dalvikassets_and_resources->ioaudioaudioaudio->assets_and_resourcesload_imageload_imageload_image->assets_and_resourcesnative_notificationnative_notificationnative_notification->assets_and_resources

Imports

  • dalvik: Java related services specific to Android and its Dalvik VM
  • io: Services from the java.io package

Clients

  • assets: Implementation of app::assets
  • audio: Android audio services, wraps a part of android audio API
  • load_image: Low-level services to load pixel data from the assets
  • native_notification: Native Java classes for notifications

Concerns

  • android: Android platform support and APIs
  • app: app.nit, a framework for portable applications
    • app_base: Base of the app.nit framework, defines App

in android::assets_and_resources

AssetManager

NativeAssetFileDescriptor

ResourcesManager

class ResourcesManager

Resource manager for android resources placed in the res folder of your app

Introduces
  • color: Get a color from resources
  • boolean: Get a Bool from resources
  • dimension: Get a dimension from resources
  • integer: Get an Integer from resources
  • string: Get a String from resources
  • raw_id: Get a resource ID from one resource in res/rawfolder
  • other_id: Get and ID from a specific resource in res/res_type folder
  • destroy: Deallocate global reference allocated by ResourcesManager
Redefines
  • SELF: Type of this instance, automatically specialized in every class
  • init

from android::activities

from app::app_base

App

app::App

redef class App

App subclasses are cross-platform applications

This class is refined by platform modules and so App can be specialized directly in the user application code.

Introduces
  • resource_manager: Resource Manager used to manage resources placed in the res folder of the app
  • resource_manager=: Resource Manager used to manage resources placed in the res folder of the app
  • asset_manager: Assets Manager used to manage resources placed in the assets folder of the app
  • asset_manager=: Assets Manager used to manage resources placed in the assets folder of the app