I want resource id of style file at runtime because I can able to access current package of application
here is styles.xml file
<style name="CustomDigitsTheme" parent="android:Theme.Material.Light">
<item name="android:textColorPrimary">@android:color/black</item>
<item name="android:textColorSecondary">@android:color/darker_gray</item>
<item name="android:windowBackground">@android:color/white</item>
<item name="android:textColorLink">#ff398622</item>
<item name="android:colorAccent">#ff398622</item>
</style>
and fro with this code snippet I am trying to fetch my customtheme
int styleId = getActivity().getResources().getIdentifier("CustomDigitsTheme", "styles",getActivity().getPackageName());
but it returns 0. So is there any other way to get style resource .
I need runtime resource because I am making cordova plugin.
Try to change styles
to style
(R.style.CustomDigitsTheme):
int styleId = getResources().getIdentifier("CustomDigitsTheme", "style", getPackageName());