How to make array of unique android ids? -
I tried to declare the array with the objects which are the property type = "id"
& lt; Item name = "viewupger_id_base" type = "id" /> & Lt; Integer-array name = "viewpager_dates" type = "id" & gt; & Lt; Item type = "id" & gt; 0 & lt; / Item & gt; & Lt; Item type = "id" & gt; 1 & lt; / Item & gt; & Lt; Item type = "id" & gt; 2 & lt; / Item & gt; & Lt; Item type = "id" & gt; 3 & lt; / Item & gt; & Lt; Item type = "id" & gt; 4 & lt; / Item & gt; & Lt; Item type = "id" & gt; 5 & lt; / Item & gt; & Lt; Item type = "id" & gt; 6 & lt; / Item & gt; & Lt; Item type = "id" & gt; 7 & lt; / Item & gt; & Lt; Item type = "id" & gt; 8 & lt; / Item & gt; & Lt; Item type = "id" & gt; 9 & lt; / Item & gt; & Lt; Item type = "id" & gt; 10 & lt; / Item & gt; & Lt; / Integer array & gt;
but did not create an ID in the IDR file. Only viewpager_id_base
id for app
It seems that you do not File in xml Try it:
& lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Resources & gt; & Lt; Item name = "id1" type = "id" /> & Lt; Item name = "id2" type = "id" /> & Lt; Item name = "id3" type = "id" /> & Lt; Item name = "id4" type = "id" /> & Lt; Item name = "id5" type = "id" /> & Lt; / Resources & gt;
and in your Java code:
int [] idArrays = new int [] {R.id.id1, R.id.id2 , R.id.id3, R.id.id4, R.id.id5};
Comments
Post a Comment