Arrays in

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

Arrays in

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

Hi all androids out there,

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

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.010 seconds, using GeSHi

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

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


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

Hello snowtiger,

The 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.001 seconds, using GeSHi

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

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


Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 2 guests