newbie
newbie

Reputation: 31

how to get string array values out of strings.xml and in to an arraylist [android]

products.add(new Product(getResources().getString(R.string.ChecklistData)),
              R.drawable.ic_launcher, false));

My StringArray in xml call CheckListData and the Arraylist that i want to add is call products

Upvotes: 0

Views: 1069

Answers (2)

Pankaj Arora
Pankaj Arora

Reputation: 10274

if ChecklistData is the string array then,use:

getResources().getStringArray(R.array.ChecklistData)

Upvotes: 0

Apoorv
Apoorv

Reputation: 13520

You have to use

getResources().getStringArray(R.array.ChecklistData)

instead of

getResources().getString(R.string.ChecklistData)

if ChecklistData is <string-array > in strings.xml

Upvotes: 1

Related Questions