Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
// Released under the Apache License, Version 2.0

import android.app.Activity;

import android.database.Cursor;

import android.provider.ContactsContract.CommonDataKinds.Email;
import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.provider.ContactsContract.Data;

public class Main {
    /**
     * Gets the dataCursor for ContactPicker and PhoneNumberPicker (used for Email and Phone).
     */
    public static Cursor getDataCursor(String id, Activity activityContext, String[] dataProjection) {
        Cursor dataCursor = activityContext.getContentResolver().query(Data.CONTENT_URI, dataProjection,
                Data.CONTACT_ID + "=? AND (" + Data.MIMETYPE + "=? OR " + Data.MIMETYPE + "=?)",
                new String[] { id, Phone.CONTENT_ITEM_TYPE, Email.CONTENT_ITEM_TYPE }, null);
        return dataCursor;
    }
}