Created
October 8, 2015 21:48
-
-
Save kiwiandroiddev/dd972eee8db7a2d845ef to your computer and use it in GitHub Desktop.
Resolves a custom Android attribute to a resource ID for an Activity's theme.
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
| public class ThemeUtils { | |
| public static int getResourceIdForAttribute(@AttrRes int attrId, Activity activity) { | |
| TypedValue outValue = new TypedValue(); | |
| activity.getTheme().resolveAttribute(attrId, outValue, true); | |
| return outValue.resourceId; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment