public class

ContactsUtils

extends Object
java.lang.Object
   ↳ com.android.contacts.ContactsUtils

Summary

Nested Classes
interface ContactsUtils.ProviderNames  
Public Constructors
ContactsUtils()
Public Methods
final static boolean areIntentActionEqual(Intent a, Intent b)
Returns true if two Intents are both null, or have the same action.
static boolean areObjectsEqual(Object a, Object b)
Returns true if two objects are considered equal.
static Intent buildImIntent(ContentValues values)
Build Intent to launch an action for the given Im or Email row.
static View createTabIndicatorView(ViewGroup parent, CharSequence label, Drawable icon)
Utility for creating a standard tab indicator view.
static View createTabIndicatorView(ViewGroup parent, ContactsSource source)
Utility for creating a standard tab indicator view.
final static CharSequence getDisplayLabel(Context context, String mimetype, int type, CharSequence label)
final static CharSequence getDisplayLabel(Context context, String mimeType, Cursor cursor)
Build the display title for the CONTENT_URI entry in the provided cursor, assuming the given mimeType.
static void initiateCall(Context context, CharSequence phoneNumber)
Kick off an intent to initiate a call.
static void initiateSms(Context context, CharSequence phoneNumber)
Kick off an intent to initiate an Sms/Mms message.
static boolean isGraphic(CharSequence str)
Test if the given CharSequence contains any graphic characters, first checking isEmpty(CharSequence) to handle null.
static Bitmap loadContactPhoto(Context context, long photoId, BitmapFactory.Options options)
static Bitmap loadContactPhoto(Cursor cursor, int bitmapColumnIndex, BitmapFactory.Options options)
Opens an InputStream for the person's photo and returns the photo as a Bitmap.
static Bitmap loadPlaceholderPhoto(int placeholderImageResource, Context context, BitmapFactory.Options options)
Loads a placeholder photo.
static ArrayList<Long> queryForAllRawContactIds(ContentResolver cr, long contactId)
static long queryForContactId(ContentResolver cr, long rawContactId)
static long queryForRawContactId(ContentResolver cr, long contactId)
static String querySuperPrimaryPhone(ContentResolver cr, long contactId)
final static boolean shouldCollapse(Context context, CharSequence mimetype1, CharSequence data1, CharSequence mimetype2, CharSequence data2)
Returns true if two data with mimetypes which represent values in contact entries are considered equal for collapsing in the GUI.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public ContactsUtils ()

Public Methods

public static final boolean areIntentActionEqual (Intent a, Intent b)

Returns true if two Intents are both null, or have the same action.

public static boolean areObjectsEqual (Object a, Object b)

Returns true if two objects are considered equal. Two null references are equal here.

public static Intent buildImIntent (ContentValues values)

Build Intent to launch an action for the given Im or Email row. Returns null when missing protocol or data.

public static View createTabIndicatorView (ViewGroup parent, CharSequence label, Drawable icon)

Utility for creating a standard tab indicator view.

Parameters
parent The parent ViewGroup to attach the new view to.
label The label to display in the tab indicator. If null, not label will be displayed.
icon The icon to display. If null, no icon will be displayed.
Returns
  • The tab indicator View.

public static View createTabIndicatorView (ViewGroup parent, ContactsSource source)

Utility for creating a standard tab indicator view.

Parameters
parent The parent ViewGroup to attach the new view to.
source The ContactsSource to build the tab view from.
Returns
  • The tab indicator View.

public static final CharSequence getDisplayLabel (Context context, String mimetype, int type, CharSequence label)

public static final CharSequence getDisplayLabel (Context context, String mimeType, Cursor cursor)

Build the display title for the CONTENT_URI entry in the provided cursor, assuming the given mimeType.

public static void initiateCall (Context context, CharSequence phoneNumber)

Kick off an intent to initiate a call.

Parameters
phoneNumber must not be null.
Throws
NullPointerException when the given argument is null.

public static void initiateSms (Context context, CharSequence phoneNumber)

Kick off an intent to initiate an Sms/Mms message.

Parameters
phoneNumber must not be null.
Throws
NullPointerException when the given argument is null.

public static boolean isGraphic (CharSequence str)

Test if the given CharSequence contains any graphic characters, first checking isEmpty(CharSequence) to handle null.

public static Bitmap loadContactPhoto (Context context, long photoId, BitmapFactory.Options options)

public static Bitmap loadContactPhoto (Cursor cursor, int bitmapColumnIndex, BitmapFactory.Options options)

Opens an InputStream for the person's photo and returns the photo as a Bitmap. If the person's photo isn't present returns null.

Parameters
bitmapColumnIndex the column index where the photo Uri is stored.
options the decoding options, can be set to null
Returns
  • the photo Bitmap

public static Bitmap loadPlaceholderPhoto (int placeholderImageResource, Context context, BitmapFactory.Options options)

Loads a placeholder photo.

Parameters
placeholderImageResource the resource to use for the placeholder image
context the Context
options the decoding options, can be set to null
Returns
  • the placeholder Bitmap.

public static ArrayList<Long> queryForAllRawContactIds (ContentResolver cr, long contactId)

public static long queryForContactId (ContentResolver cr, long rawContactId)

public static long queryForRawContactId (ContentResolver cr, long contactId)

public static String querySuperPrimaryPhone (ContentResolver cr, long contactId)

public static final boolean shouldCollapse (Context context, CharSequence mimetype1, CharSequence data1, CharSequence mimetype2, CharSequence data2)

Returns true if two data with mimetypes which represent values in contact entries are considered equal for collapsing in the GUI. For caller-id, use compare(Context, String, String) instead