• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

A sentence about usefulness of Resources

 
Ranch Hand
Posts: 36
1
Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
In "Hello Android" book that i am reading , there is a sentence about usefulness of Resources that i can't understand .
Please give me some help about it .
The paragraph is :

"The resource compiler compresses and packs your resources and then
generates a class named R that contains identifiers you use to reference
those resources in your program. This is a little different from standard
Java resources, which are referenced by key strings. Doing it this way
allows Android to make sure all your references are valid and saves
space by not having to store all those resource keys
. Eclipse uses a
similar method to store and reference the resources in Eclipse plug-ins."

The underlined sentence has two part .

I understand part one in this way :
When there is some error in for example XML lay out files in Android project in Eclipse IDE ,
The IDE does not work correctly and some red signs are appeared next to files that have
error in left side project browser of Eclipse.

Is the thing that i understood is correct and complete ???

And about part two .
I cant understand it . What it says ??

Thanks for your help
 
Rancher
Posts: 43081
77
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, part 1 is about checking the correctness of resources at compile time, or -in the case of IDEs such as Eclipse- even earlier than that.

Part 2 says that at runtime resources are referenced by integers. If you've seen such an R.java file you'll notice it's essentially just a list of all resources, each one identified by a unique int. An int takes up a lot less storage space than most strings - which is what you'd use in desktop or server Java code to identify resources (e.g. as keys in Properties files). Storage space is more at a premium in mobile platforms, so anything that reduces it is welcome.
reply
    Bookmark Topic Watch Topic
  • New Topic