I have this kind of array under arrays.xml :
<string-array name="menu_icons">
<item>?attr/book_icon</item>
<item>?attr/book_icon</item>
<item>?attr/book_icon</item>
<item>?attr/book_icon</item>
<item>?attr/book_icon</item>
<item>?attr/book_icon</item>
</string-array>
Under styles.xml :
<attr name="book_icon" format="reference" />
But how can I retrieve this from Java code ?
I have try this :
TypedArray icons = context.getResources().obtainTypedArray(R.array.menu_icons);
icons.getDrawable(i);//Crash Resource is not a Drawable (color or path): TypedValue
icons.getRessourceId(i, -1);//Crash Resource is not a Drawable (color or path): TypedValue
No comments:
Post a Comment