title: Android: How to obtain the resource ID of the current theme?
body: <p>In Android, you can get the current theme of an activity as a <code>Resource.Theme</code> object from <code>getTheme()</code>. Also, you can set the theme to a different one via that other theme's resource id, as in <code>setTheme(R.style.Theme_MyTheme)</code>.</p>
  
  <p>But how do I find out whether it's worth it -- whether the current theme is already the one that I would want to set? I am looking for something like <code>getTheme().getResourceId()</code>, in order to write something like:</p>
  
  <pre><code>protected void onResume() {
      int newThemeId = loadNewTheme();
      if (newThemeId != getTheme().getResourceId()) { // !!!! How to do this?
          setTheme(newThemeId);
          // and rebuild the gui, which is expensive
      }
  }
  </code></pre>
  
  <p>Any ideas?</p>