title: Android theme name from theme ID
body: <p>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 <strong>theme's name</strong>?</p>
  
  <p>Thanks</p>
  
  <hr>
  
  <h2>Solution</h2>
  
  <pre><code>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;
      }
  }
  </code></pre>