Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Build a Self-Destructing Message Android App Capturing Photos and Videos Setting Where Photos are Saved

Lisa Steendam
Lisa Steendam
6,825 Points

My Locale isn't recognized

I would like to use the Belgian Locale but I get an error on both Locale.BE and Locale.nl_BE The error is "cannot resolve symbol 'BE'" or "cannot resolve symbol 'nl_BE'" I will use the UK Locale now, but does anyone know what I should use for Belgium?

Raghda Talaa't
Raghda Talaa't
2,944 Points

You can use it like this:

String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss", new Locale("be")).format(now);

Doing so will format the dates according to that Locale whenever relevant.

You can also use getDefault() to get an appropriate locale for the user of the device you're running on, or getAvailableLocales() to get a list of all the locales available on the device you're running on.

Lisa Steendam
Lisa Steendam
6,825 Points

Thank you, that solved it .

Raghda Talaa't
Raghda Talaa't
2,944 Points

You're welcome, but please make it best answer so that others know that this question has been solved.

Lisa Steendam
Lisa Steendam
6,825 Points

You need to put your answer in an answer ("Add answer") not a comment for me to be able to select it as best answer.

1 Answer

Raghda Talaa't
Raghda Talaa't
2,944 Points

You can use it like this:

String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss", new Locale("be")).format(now);

Doing so will format the dates according to that Locale whenever relevant.

You can also use getDefault() to get an appropriate locale for the user of the device you're running on, or getAvailableLocales() to get a list of all the locales available on the device you're running on.