How to use new API elements like Switch so, that the app is compatible with older Android version?
<p>I want to use new UI elements like Switch for new Android devices, and by older devices I would use something else like Button.</p>

<p>I have created to layouts</p>

<pre><code>~/res/
   layout/main.xml
   layout-v14/main.xml
</code></pre>

<p>that has different elements like Button in <code>layout/main.xml</code> and Switch in <code>layout-v14/main.xml</code></p>

<p>But how can I add different elements in the Activity, without to get Exception like</p>

<pre><code>Could not find class 'android.widget.Switch' ... 
</code></pre>
