Skip to content

Instantly share code, notes, and snippets.

@laaptu
Last active September 13, 2019 15:56
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laaptu/9628e40024b5a020f066 to your computer and use it in GitHub Desktop.
Save laaptu/9628e40024b5a020f066 to your computer and use it in GitHub Desktop.
How to get theme id
<attr name="themeName" format="string"/>
TypedValue outValue = new TypedValue();
getTheme().resolveAttribute(R.attr.themeName, outValue, true);
if(outValue.equals(getString(R.string.custom_title_theme))){
//you have applied this theme else not
}
//http://stackoverflow.com/questions/7267852/android-how-to-obtain-the-resource-id-of-the-current-theme
<style name="fs.CustomActionbar" parent="@style/fs">
<item name="android:actionBarStyle">@style/ActionBar.Solid.CustomFsa</item>
<item name="themeName">@string/custom_title_theme</item>
</style>
<string name="custom_title_theme">customTitleTheme</string>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment