Set size of customView with a variable
<p>I have a customm view which generates an arc and i've put in the xml like this</p>

<pre><code>&lt;com.example.application.ArcView
        android:id="@+id/arcView1"
        android:layout_width="@string/arc_size"
        android:layout_height="@string/arc_size"
        android:layout_centerInParent="true" /&gt;
</code></pre>

<p>I have the height and width that change based on the screen density</p>

<p>I've coded it like this but it doesn't work</p>

<pre><code>Resources res = getResources();
    String arcSizeString = res.getString(R.string.arc_size);

    DisplayMetrics metrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(metrics);
    switch(metrics.densityDpi){
         case DisplayMetrics.DENSITY_LOW:
             arcSize = 170;
             arcSizeString = (arcSize + "px");
                    break;
         case DisplayMetrics.DENSITY_MEDIUM:
             arcSize = 227;
             arcSizeString = (arcSize + "px");
                     break;
         case DisplayMetrics.DENSITY_HIGH:
             arcSize = 342;
             arcSizeString = (arcSize + "px");
                     break;
    }       
</code></pre>

<p>How can i set the width and height to a variable?</p>
