Android: How to obtain the resource ID of the current theme?

I found a way to solve the requirement without getting the resource id.

I’m adding an item to each of my themes with the name of the string:

<item name="themeName">dark</item>

And in the code I check the name like so:

TypedValue outValue = new TypedValue();
getTheme().resolveAttribute(R.attr.themeName, outValue, true);
if ("dark".equals(outValue.string)) {
   ...
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)