This should complete the task:
TypedValue typedValue = new TypedValue(); Theme theme = context.getTheme(); theme.resolveAttribute(R.attr.theme_color, typedValue, true); @ColorInt int color = typedValue.data;
Also remember to apply the theme to your activity before calling this code. Or use:
android:theme="@style/Theme.BlueTheme"
in your manifest or call (before calling setContentView(int) ):
setTheme(R.style.Theme_BlueTheme)
in onCreate() .
I tested it with your values ββand it worked perfectly.
Emanuel Moecklin Jun 24 '13 at 14:16 2013-06-24 14:16
source share