I get an integer and I need to convert to a month names in various locales:
Example for locale en-us:
1 -> January
2 -> February
Example for locale e
There is an issue when you use DateFormatSymbols class for its getMonthName method to get Month by Name it show Month by Number in some Android devices. I have resolved this issue by doing this way:
In String_array.xml
- January
- February
- March
- April
- May
- June
- July
- August
- September
- October
- November
- December
In Java class just call this array like this way:
public String[] getYearMonthName() {
return getResources().getStringArray(R.array.year_month_names);
//or like
//return cntx.getResources().getStringArray(R.array.month_names);
}
String[] months = getYearMonthName();
if (i < months.length) {
monthShow.setMonthName(months[i] + " " + year);
}
Happy Coding :)