I need to know the name of the current theme, I already have the theme's resource ID. Anybody knows how to get the current theme's name?
Thanks
public String getThemeName() { PackageInfo packageInfo; try { packageInfo = getPackageManager().getPackageInfo(getPackageName(), PackageManager.GET_META_DATA); int themeResId = packageInfo.applicationInfo.theme; return getResources().getResourceEntryName(themeResId); } catch (NameNotFoundException e) { return null; } }
Try using getResourceEntryName()
or getResourceName()
on Resources
(typically retrieved via getResources()
), depending on what you are aiming for.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With