mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 19:52:17 -05:00
Cache information whether or not contact picker intent is available for this device.
This commit is contained in:
parent
b6561c8b29
commit
277c358f87
@ -85,6 +85,7 @@ public abstract class Contacts {
|
||||
|
||||
protected Context mContext;
|
||||
protected ContentResolver mContentResolver;
|
||||
protected Boolean mHasContactPicker;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@ -192,10 +193,10 @@ public abstract class Contacts {
|
||||
* @return True, if the device supports picking contacts. False, otherwise.
|
||||
*/
|
||||
public boolean hasContactPicker() {
|
||||
if (mContext.getPackageManager().queryIntentActivities(contactPickerIntent(), 0).size() > 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
if (mHasContactPicker == null) {
|
||||
mHasContactPicker = (mContext.getPackageManager().
|
||||
queryIntentActivities(contactPickerIntent(), 0).size() > 0);
|
||||
}
|
||||
return mHasContactPicker;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user