Set Text Size with a dimension got by a String
<p>I'm using this function to get by Java a dimension from my dimens.xml file:</p>

<pre><code>public static float getDimen(Context context, String name)
{
    Assert.assertNotNull(context);
    Assert.assertNotNull(name);

    Resources res = context.getResources();
    int dimensionID = res.getIdentifier(name, "dimen", context.getPackageName());

    return res.getDimension(dimensionID);
}
</code></pre>

<p>This works like: <code>getDimen(mContext, "textsize_small")</code> and retrieves the "R.dimen.textsize_small" value (or at least it should).</p>

<pre><code>&lt;resources&gt;
      &lt;dimen name="textsize_small"&gt;10dp&lt;/dimen&gt;
      &lt;dimen name="textsize_medium"&gt;13dp&lt;/dimen&gt;
      &lt;dimen name="textsize_large"&gt;15dp&lt;/dimen&gt;
      &lt;dimen name="textsize_xlarge"&gt;17dp&lt;/dimen&gt;
&lt;/resources&gt;
</code></pre>

<p>So, after having this value I use it to set the TextSize of a TextView:</p>

<pre><code>float textsize = getDimen(mContext, "textsize_" + object.getDesiredSize);
textview.setTextSize(textsize);
Log.d(TAG, "TextSize: " + textview.getTextSize());
</code></pre>

<p>EDIT:</p>

<p>I set <code>android:textSize="@dimen/textsize_small"</code> and used <code>getDimen(mContext, "textsize_small")</code>. In the first one the Log.d returns <strong>15.0</strong> and in the second one returns <strong>22.5</strong></p>

<p>Is any type conversion missing?</p>
