Arrays in R.java

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Arrays in R.java

Postby snowtiger » Fri Dec 21, 2007 11:07 am

Hi all androids out there,

i have just found out, that the original R.java contains some arrays of IDs, i.e.
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public static final int ViewGroup_MarginLayout[] = {
  2.  
  3.             0x1010051, 0x1010052, 0x1010053, 0x1010054, 0x1010055, 0x1010056
  4.  
  5.         };
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


Anybody has an idea, how I can do this? I have really a lot of icon sets and atm i build an array with all the R.drawable.XYZ manually with:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. int[] foobar = {R.drawable.x, R.drawable.y...}
Parsed in 0.030 seconds, using GeSHi 1.0.8.4

in the java code, and its getting more and more...

It would be nice, if I can have this array in the R.java.
snowtiger
Developer
Developer
 
Posts: 34
Joined: Fri Dec 21, 2007 10:44 am

Top

Postby plusminus » Fri Dec 21, 2007 4:49 pm

Hello snowtiger,

The R.java is not user-modifiable (or at least you should not modify it ;) ).

There already is a tutorial like what you are probably searching for.
:arrow: :src: go here.

It is about defining String-Arrays in XML, but you probably can define @-relative Arrays to the Drawables.

Probably like (untested !):
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <resources>
  3. <array name="fileEndingImage">
  4.         <item>@drawable/image1</item>
  5.         <item>@drawable/image2</item>
  6.         <item>@drawable/image3</item>
  7.         <item>@drawable/image4</item>
  8.     </array>
  9. </resources>
Parsed in 0.002 seconds, using GeSHi 1.0.8.4


Let us know how if/how you solved it :)

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 5 guests