diff options
author | Matt Garnes <matt@cyngn.com> | 2015-06-10 14:51:08 -0700 |
---|---|---|
committer | Matt Garnes <matt@cyngn.com> | 2015-06-10 14:51:08 -0700 |
commit | ff213cdd08e445b55bca4cc4577fbec45a7ef551 (patch) | |
tree | 8e4e1895ab02153fe8236cebbf67e037298e0285 | |
parent | a32d3fbe337453726d526f259ac5bda8abed8cb3 (diff) | |
download | packages_apps_Contacts-ff213cdd08e445b55bca4cc4577fbec45a7ef551.tar.gz packages_apps_Contacts-ff213cdd08e445b55bca4cc4577fbec45a7ef551.tar.bz2 packages_apps_Contacts-ff213cdd08e445b55bca4cc4577fbec45a7ef551.zip |
Keep a local instance of mContactData when copying to SIM card.
Copying to SIM card can take a long time while it reads data about
available space on the SIM. If the user leaves the activity,
mContactData will be set to null and copyToCard will throw an NPE trying
to call methods on it.
Keep a local instance of this variable that the
thread can reference later.
Change-Id: Ie5187372b6fb2b23b00e266a175c91b8051e651e
-rw-r--r-- | src/com/android/contacts/quickcontact/QuickContactActivity.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/com/android/contacts/quickcontact/QuickContactActivity.java b/src/com/android/contacts/quickcontact/QuickContactActivity.java index 90a7fd6ff..d4cae72bf 100644 --- a/src/com/android/contacts/quickcontact/QuickContactActivity.java +++ b/src/com/android/contacts/quickcontact/QuickContactActivity.java @@ -2750,6 +2750,7 @@ public class QuickContactActivity extends ContactsActivity { private Handler mHandler = null; private void copyToCard(final int sub) { + final Contact contactData = mContactData; final int MSG_COPY_DONE = 0; final int MSG_COPY_FAILURE = 1; final int MSG_CARD_NO_SPACE = 2; @@ -2835,12 +2836,12 @@ public class QuickContactActivity extends ContactsActivity { int emptyNumTotal = totalEmptyAdn + totalEmptyAnr; // Get name string - String strName = mContactData.getDisplayName(); + String strName = contactData.getDisplayName(); ArrayList<String> arrayNumber = new ArrayList<String>(); ArrayList<String> arrayEmail = new ArrayList<String>(); - for (RawContact rawContact : mContactData.getRawContacts()) { + for (RawContact rawContact : contactData.getRawContacts()) { for (DataItem dataItem : rawContact.getDataItems()) { if (dataItem.getMimeType() == null) { continue; |