Код: Выделить всё
public class CountryVO {
private String countryCode;
private String countryName;
private Drawable countryFlag;
public String getCountryCode() {
return countryCode;
}
public void setCountryCode(String countryCode) {
this.countryCode = countryCode;
}
public String getCountryName() {
return countryName;
}
public void setCountryName(String countryName) {
this.countryName = countryName;
}
public Drawable getCountryFlag() {
return countryFlag;
}
public void setCountryFlag(Drawable countryFlag) {
this.countryFlag = countryFlag;
}
}
Код: Выделить всё
Albania
al
@drawable/al
Algeria
dz
@drawable/dz
American Samoa
as
@drawable/as
India
in
@drawable/in
South Africa
sa
@drawable/sa
Код: Выделить всё
TypedArray customArr = getResources().obtainTypedArray(R.array.country_arr);
CountryVO vo = new CountryVO();
vo.setCountryName(**value from array come here for first element's countryName attribute**);
vo.setCountryCode(**value from array come here for first element's countryCode attribute**);
vo.setCountryFlag(**value from array come here for first element's countryFlag attribute**);
Я попробовал customArr.getString(0);, но это дает мне все в виде строки типа «Албания аль @drawable/al»
Пожалуйста, помогите мне решить эту проблему.
Подробнее здесь: https://stackoverflow.com/questions/677 ... rieve-them
Мобильная версия