Created
October 9, 2016 14:21
-
-
Save webserveis/6ddc2d2b09789fb04411d09903796c9c to your computer and use it in GitHub Desktop.
Get atributes android programallity
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private int fetchAccentColor(Activity context) { | |
TypedValue typedValue = new TypedValue(); | |
TypedArray a = context.obtainStyledAttributes(typedValue.data, new int[]{R.attr.colorAccent}); | |
int color = a.getColor(0, 0); | |
a.recycle(); | |
return color; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private int fetchTextPrimaryColor() { | |
TypedValue typedValue = new TypedValue(); | |
TypedArray a = obtainStyledAttributes(typedValue.data, new int[]{android.R.attr.textColorPrimary,}); | |
int color = a.getColor(0, 0); | |
a.recycle(); | |
return color; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment