From f47255f6fcdcf94c55c580b1784af1cfa3f2f7e3 Mon Sep 17 00:00:00 2001 From: Todd Kennedy Date: Thu, 2 Jun 2011 11:55:24 -0700 Subject: [PATCH] Fix NPE accessing fragment arguments Change-Id: I417927568c2407f1d183f3d112d0761f57b5bb12 --- .../email/activity/ShortcutPickerFragment.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/com/android/email/activity/ShortcutPickerFragment.java b/src/com/android/email/activity/ShortcutPickerFragment.java index fe8bb1f59..a855b51c6 100644 --- a/src/com/android/email/activity/ShortcutPickerFragment.java +++ b/src/com/android/email/activity/ShortcutPickerFragment.java @@ -52,11 +52,11 @@ import android.widget.AdapterView.OnItemClickListener; public abstract class ShortcutPickerFragment extends ListFragment implements OnItemClickListener, LoaderCallbacks { /** Allow all mailboxes in the mailbox list */ - public static int FILTER_ALLOW_ALL = 0x00; + public static int FILTER_ALLOW_ALL = 0; /** Only allow an account's INBOX */ - public static int FILTER_INBOX_ONLY = 0x01; + public static int FILTER_INBOX_ONLY = 1 << 0; /** Allow an "unread" mailbox; this is not affected by {@link #FILTER_INBOX_ONLY} */ - public static int FILTER_ALLOW_UNREAD = 0x02; + public static int FILTER_ALLOW_UNREAD = 1 << 1; /** Fragment argument to set filter values */ public static final String ARG_FILTER = "ShortcutPickerFragment.filter"; /** The filter values; default to allow all mailboxes */ @@ -87,10 +87,6 @@ public abstract class ShortcutPickerFragment extends ListFragment public void onAttach(Activity activity) { super.onAttach(activity); - Bundle args = getArguments(); - if (args != null) { - mFilter = args.getInt(ARG_FILTER); - } if (activity instanceof PickerCallback) { mCallback = (PickerCallback) activity; } @@ -239,7 +235,7 @@ public abstract class ShortcutPickerFragment extends ListFragment ShortcutPickerFragment fragment = new MailboxShortcutPickerFragment(); final Bundle args = new Bundle(); args.putParcelable(MailboxShortcutPickerFragment.ARG_ACCOUNT, account); - args.putInt(ARG_FILTER, getArguments().getInt(ARG_FILTER)); + args.putInt(ARG_FILTER, getFilter()); fragment.setArguments(args); getFragmentManager() .beginTransaction()