From 277c358f87eb25783efaf3cc7185cab05b34fb1d Mon Sep 17 00:00:00 2001 From: cketti Date: Thu, 24 Mar 2011 05:11:03 +0100 Subject: [PATCH] Cache information whether or not contact picker intent is available for this device. --- src/com/fsck/k9/helper/Contacts.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/com/fsck/k9/helper/Contacts.java b/src/com/fsck/k9/helper/Contacts.java index 66cbe8335..7f3e6e441 100644 --- a/src/com/fsck/k9/helper/Contacts.java +++ b/src/com/fsck/k9/helper/Contacts.java @@ -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; } }