Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
public static Description getDescriptionsFromJson(JsonElement jsonElement){
Description description = new Description();
for (Map.Entry<String, JsonElement> entry :jsonElement.getAsJsonObject().entrySet()){
if(entry.getKey().equalsIgnoreCase("en") || entry.getKey().equalsIgnoreCase(getDefaultLangCode()))
description.descriptionMap.put(entry.getKey(), entry.getValue().getAsString());
return description;
public static String getDefaultCode(Context context){
String locale = context.getResources().getConfiguration().locale.getLanguage();
return locale.toLowerCase();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment