Contacts and ContactsContract in the same app
<p>I have it done right now with an if statement and the code for each every time, but what I'd like to do is something like this:</p>

<pre><code>import android.content.Intent;
import android.provider.Contacts;
import android.provider.ContactsContract;

public class AddContacts{
    public static void newContacts(){

        Intent i = new Intent(Intent.ACTION_INSERT);
        i.setType(ContactsContract.Contacts.CONTENT_TYPE);

        i.putExtra(ContactsContract.Intents.Insert.NAME, Directory.ResultsDetails[0]);
        i.putExtra(ContactsContract.Intents.Insert.PHONE, Directory.ResultsDetails[4]);
        i.putExtra(ContactsContract.Intents.Insert.PHONE_TYPE, 3);
        i.putExtra(ContactsContract.Intents.Insert.EMAIL, Directory.ResultsDetails[3]);
        i.putExtra(ContactsContract.Intents.Insert.EMAIL_TYPE, 2);

        startActivity(i);
    }

    public static void oldContacts(){

        Intent i = new Intent(Contacts.Intents.Insert.ACTION, Contacts.People.CONTENT_URI);
        i.putExtra(Contacts.Intents.Insert.NAME, Directory.ResultsDetails[0]);
        i.putExtra(Contacts.Intents.Insert.PHONE, Directory.ResultsDetails[4]);
        i.putExtra(Contacts.Intents.Insert.PHONE_TYPE, 3);
        i.putExtra(Contacts.Intents.Insert.EMAIL, Directory.ResultsDetails[3]);
        i.putExtra(Contacts.Intents.Insert.EMAIL_TYPE, 2);

        startActivity(i);

    }

}
</code></pre>

<p>and then have something like:</p>

<pre><code>if(sdk &gt;=5){
    AddContacts.newContacts();
}else{
    AddContacts.oldContacts();}
</code></pre>

<p>when the 'Add to Contacts' button is pressed.</p>

<p>Unfortunately, I'm not sure how I should do this. I tried making a new class in the package (AddContacts) and putting those in, but it won't let me start an activity that way. I'd like to push this code out to it's own class because it will save some clutter in the rest of my app. Any help is appreciated!</p>

<p>The error I get is on startActivity(i); | The method startActivity(Intent) is undefined for the type AddContacts</p>
