How to set Spanish locale in blackberry below is my code and its giving error,
I am using net.rim.device.api.i18n.Locale library
import net.rim.device.api.i18n.Locale;
import net.rim.device.api.i18n.SimpleDateFormat;
public static String formatDate(Date date)
{
String dateFormat = UserSettingManager.getUserSetting(UserSettingManager.PREF_DATE_FORMAT);
if(StringUtils.isEmptyOrWhitespace(dateFormat))
{
dateFormat = DEFAULT_DATE_FORMAT;
}
SimpleDateFormat formatter;
try
{
if(!isLanguageChangeToSpanish()){
formatter = new SimpleDateFormat(dateFormat);
}else {
formatter = new SimpleDateFormat(dateFormat, Locale.get(Locale.LOCALE_es, "es"));
}
}
catch(Exception e)
{
//If format received from server is wrong just display the default...
if(!isLanguageChangeToSpanish()){
formatter = new SimpleDateFormat(DEFAULT_DATE_FORMAT);
}else {
formatter = new SimpleDateFormat(DEFAULT_DATE_FORMAT, Locale.get(Locale.LOCALE_es, "es"));
}
}
return formatter.format(date);
}
ERROR : cannot find symbol constructor SimpleDateFormat(java.lang.String,net.rim.device.api.i18n.Locale)
Looks like a compiler problem.
That constructor exists since OS 4.5. Maybe you have the compiler set up to an older OS version?