title: How does one use Resources.getFraction()?
body: <p>How do I store a fractional value like <code>3.1416</code> in resources? What to write in the XML and how to retrieve it in Java code?</p>
  
  <p>The documentation for <a href="http://developer.android.com/reference/android/content/res/Resources.html#getFraction%28int,%20int,%20int%29" rel="noreferrer"><code>getFraction()</code></a> states:</p>
  
  <blockquote>
    <p><code>public float getFraction (int id, int base, int pbase)</code></p>
    
    <p>Retrieve a fractional unit for a particular resource ID.</p>
    
    <p><strong>Parameters</strong><br>
    <code>base</code>    The base value of this fraction. In other words, a standard
    fraction is multiplied by this value.<br>
    <code>pbase</code>   The parent base value of
    this fraction. In other words, a parent fraction (nn%p) is multiplied
    by this value.</p>
    
    <p><strong>Returns</strong><br>
    Attribute fractional value multiplied by the
    appropriate base value</p>
  </blockquote>
  
  <p><a href="https://stackoverflow.com/a/6021880/165674">This answer</a> shows a simple example of percentages without going into the details of what the arguments mean.</p>