¿Alguien puede convertir el código siguiente Kotlin a java

aroo:

Alguien por favor convertir el código java a Kotlin

sharedPreferences = getSharedPreferences("ThemePref", Context.MODE_PRIVATE)

//   getTheme()applyStyle(R.style.OverlayThemeLime, true) in Java
//        theme.applyStyle(R.style.OverlayThemeBlue, true) // -> Replaced
when (sharedPreferences.getString(themeKey, "red")) {
    "lime" ->  theme.applyStyle(R.style.OverlayThemeLime, true)
    "red" ->  theme.applyStyle(R.style.OverlayThemeRed, true)
    "green" ->  theme.applyStyle(R.style.OverlayThemeGreen, true)
    "blue" ->  theme.applyStyle(R.style.OverlayThemeBlue, true)
}

Necesito el código de Java de este. PS: No consumo estudio de Android por lo que no hay ninguna opción para convertir.

SRA :
sharedPreferences = getSharedPreferences("ThemePref", Context.MODE_PRIVATE);

String result = sharedPreferences.getString(themeKey, "red");
switch (result) {
    case "lime":
        getTheme().applyStyle(R.style.OverlayThemeLime, true);
        break;
    case "red":
        getTheme().applyStyle(R.style.OverlayThemeRed, true);
        break;
    case "green":
        getTheme().applyStyle(R.style.OverlayThemeGreen, true);
        break;
    case "blue":
        getTheme().applyStyle(R.style.OverlayThemeBlue, true);
        break;
    default:
        break;
}

Supongo que te gusta

Origin http://10.200.1.11:23101/article/api/json?id=404281&siteId=1
Recomendado
Clasificación