Java tutorial
//package com.java2s; import android.content.Context; import android.os.Build; public class Main { public static void setTheme(boolean dialog, Context context) { int theme = android.R.style.Theme_Black; if (Build.VERSION.SDK_INT >= 11) { theme = 0x0103006b; //-> android.R.Theme_Holo, needed, because build target is only 2.3.1 if (dialog) theme = 0x0103006f; //-> android.R.Theme_Holo_Dialog, needed, because build target is only 2.3.1 } else { if (dialog) { theme = android.R.style.Theme_Dialog; } } context.setTheme(theme); } }