I have a class like
public class CountryVO {
private String countryCode;
private String countryName;
private Drawable countryFlag;
public St
Here is example. Read it and look at the methods of TypedArray like get...() for example getDrawable(int index). I would suggest to keep items of the same type in separated arrays.
- Albania
- Algeria
- American Samoa
- al
- dz
- as
- @drawable/dz
- @drawable/al
- @drawable/as
EDIT:
public CountryVO getCountryVO(int index){
Resources resources = getResources();
TypedArray country = resources.obtainTypedArray(R.array.country);
TypedArray code = resources.obtainTypedArray(R.array.code);
TypedArray flag = resources.obtainTypedArray(R.array.flag);
CountryVO vo = new CountryVO(country.getString(index), code.getString(index), flag.getDrawable(index));
country.recycle();
code.recycle();
flag.recycle();
return vo;
}