Android, trying to enlarge text if it's on a bigger screen
<p>I am trying to enlarge the size of text in a button as the screen gets wider.  At first it seemed my code worked, but on different android devices it does not work. It will change the font to a big size on a small screen.   </p>

<p>This is what I'm doing:</p>

<pre><code> int w=getWindowManager().getDefaultDisplay().getWidth();

        Button but1=new Button(this);
//        but1.setTextColor( Color.parseColor("#ffd79825")); 
        if (w&lt;400)
            but1.setTextSize(10.0f);
        else
        if (w&lt;650)
            but1.setTextSize(14.0f);
        else
             if (w&gt;470)
                but1.setTextSize(18.0f);
</code></pre>
