0

In Xamarin Android, how do I get the current theme name programmatically? I need to get the name as a string such as "Theme.AppCompat.Light.Dialog".

Mark13426
  • 2,569
  • 6
  • 41
  • 75

1 Answers1

1

You may refer to the code bellow:

PackageInfo packageInfo;

packageInfo = PackageManager.GetPackageInfo(PackageName,PackageInfoFlags.MetaData);
int themeResId = packageInfo.ApplicationInfo.Theme;
var name = Theme.Resources.GetResourceEntryName(themeResId);

And here is the reference about how to get theme name in Android project(using java)

Community
  • 1
  • 1
Scavenger
  • 207
  • 2
  • 9