android - Adding layout IDs into arrays.xml -


is possible have layout ids inside arrays.xml. tried following doesn't work:

<integer-array name="layouts_list">         <item>r.layout.layout1</item>         <item>r.layout.layout2</item>         <item>r.layout.layout3</item>         <item>r.layout.layout4</item>         <item>r.layout.layout5</item> </integer-array> 


other alternatives ?
however, can have integer array inside constants.java curious know if has done similar above.

the correct syntax

<integer-array name="layouts_list">     <item>@layout/layout1</item>     <item>@layout/layout2</item>     ... </integer-array> 

but i'm pretty sure won't work, since @layout/layout1 not of type integer.

what would work require manual extraction this:

<array name="layouts_list">     <item>@layout/layout1</item>     <item>@layout/layout2</item>     ... </array> 

you can use getresources().obtaintypedarray typedarray representing array. then, can use getresourceid get, well, resource id. don't forget recycle() typedarray!


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

php - joomla get content in onBeforeCompileHead function -