Forms and returns an intent to create new contact. - Android Account

Android examples for Account:Contact

Description

Forms and returns an intent to create new contact.

Demo Code


import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.provider.ContactsContract;
import com.android.qrcodecontact.entity.QRCodeContact;
import java.io.File;

public class Main{
    /**/*from  www .  j a v  a2  s. c o m*/
     * Forms and returns an intent to create new contact.
     *
     * @param qrc QRCodeContact
     * @return the intent
     */
    public static Intent getCreateNewContactIntent(QRCodeContact qrc) {
        Intent i = new Intent(Intent.ACTION_INSERT);
        i.setType(ContactsContract.Contacts.CONTENT_TYPE);
        i.putExtra(ContactsContract.Intents.Insert.NAME,
                qrc.getContact_Name());
        i.putExtra(ContactsContract.Intents.Insert.PHONE,
                qrc.getContact_Phone());
        return i;
    }
}

Related Tutorials