我使用Custom Adapter和ArrayList Data Type创建了这个ArrayList,如下所示,
ArrayList<Question> questionsArrayList = new ArrayList<>();
questionsArrayList.add(new Question("Question 1:", "What is his Favorite Color?", "Blue", "Green", "Red"));
questionsArrayList.add(new Question("Question 2:", "What is his Favorite Band of All Time?", "Linkin Park", "Led Zeppelin", "My Chemical Romance"));
questionsArrayList.add(new Question("Question 3:", "Where is his place of birth?", "Calamba, Laguna", "Barangka, Marikina", "Sampaloc, Manila"));
questionsArrayList.add(new Question("Question 4:", "Is he handsome?", "Yes", "Hollie Macaroni", "I think so"));
现在我的问题是,是否可以为每个数组的特定元素分配资源ID?假设我想将资源ID分配给“Blue”,“Led Zeppelin”,“Barangka,Marikina”和“Hollie Macaroni”。
有可能吗? 谢谢!
答案 0 :(得分:0)
是否可以为每个Array的特定元素分配资源ID?
您可以将Integer(资源ID)映射到Question对象,是的。
让我们说我想将资源ID分配给&#34; Blue&#34;,&#34; Led Zeppelin&#34;,&#34; Barangka,Marikina&#34;和&# 34; Hollie Macaroni&#34;
听起来你想要R.string值,而不是R.id