I'm developing a simple weather applications using the yahoo API.
The method weatherInfo.getCurrentText()
results in a string with the current weather condition in English.
For each weather condition there is an assigned code (list of condition + code here)
What I would like to do is to get the code with weatherInfo.getCurrentCode()
and use a custom string. This will allow me to provide correct translations.
I'm trying to do this with string-array:
<string-array name="weather_conditions">
<item0>Sunny</item0>
<item1>Cloudy</item1>
etc...
</string-array>
So, once I get the weather code is there any way I can assign the item on my string array?
mWeatherCode = get the code (assuming 10)
mText.setText(the item10 on my array list)
String[] conditions = getResources().getStringArray(R.array.weather_conditions);
if(mWeatherCode < 0 || mWeatherCode > conditions.length) {
mText.setText(R.string.err_invalid_condition);
} else {
mText.setText(conditions[mWeatherCode]);
}