Setting up Android code for different runtimes
<p>I am working on an Android application that is supposed to run on Android 1.5 and later devices. I am using <code>RawContacts.CONTENT_URI</code> enumeration for registering a <code>ContentObserver</code> in my application subclass. Now, RawContacts was introduced in Eclair and running this code on Android devices having runtime less than 2.0, gives java.lang.VerifyError. For older devices, I have to use <code>Contacts.CONTENT_URI</code>.</p>

<p>So to fix this, I've put something like the following in my code:</p>

<pre><code>if(Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.ECLAIR){
  uri = android.provider.ContactsContract.RawContacts.CONTENT_URI;
}
else{
  uri = android.provider.Contacts.CONTENT_URI;
}
</code></pre>

<p>I am still getting java.lang.VerifiyErrors.</p>

<p>How do I setup my code for different runtimes?</p>
