Skip to content

Instantly share code, notes, and snippets.

@saurabharora90
Created January 10, 2018 11:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saurabharora90/cd18194eda90a2e606aee347b107e760 to your computer and use it in GitHub Desktop.
Save saurabharora90/cd18194eda90a2e606aee347b107e760 to your computer and use it in GitHub Desktop.
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