Referencing System Resources Android

You can access system resources in addition to your own resources. The android package contains all kinds of resources, which you can browse by looking in the android.R subclasses.

Here you find system resources for

  • Animation sequences for fading in and out
  • Arrays of email/phone types (home, work, and such)
  • Standard system colors
  • Dimensions for application thumbnails and icons
  • Many commonly used drawable and layout types
  • Error strings and standard button text
  • System styles and themes

You can reference system resources the same way you use your own; set the package name to android. For example, to set the background to the system color for darker gray, you set the appropriate background color attribute to @android:color/darker_gray.

You can access system resources much like you access your application’s resources. Instead of using your application resources, use the Android package’s resources under the android.R class.

If we go back to our animation example, we could have used a system animation instead of defining our own. Here is the same animation example again, except it uses a system animation to fade in:




Face Book Twitter Google Plus Instagram Youtube Linkedin Myspace Pinterest Soundcloud Wikipedia

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Android Topics