From fa7cbb812220a71bcdfd15967f0f3abe383d151d Mon Sep 17 00:00:00 2001 From: Ricky Barrette Date: Sat, 26 May 2012 13:27:31 -0400 Subject: [PATCH] Fixed the null pointer caused by calling getActivity() before the fragment had one. Also I fixed the loading of the feaure list of saved ringers Signed-off-by: Ricky Barrette --- .../ui/fragments/FeatureListFragment.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/FeatureListFragment.java b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/FeatureListFragment.java index 220bea6..ff32a68 100644 --- a/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/FeatureListFragment.java +++ b/LocationRinger/src/com/TwentyCodes/android/LocationRinger/ui/fragments/FeatureListFragment.java @@ -59,7 +59,6 @@ public class FeatureListFragment extends BaseFragmentListFragment implements OnC mInfo = info; mListener = listener; mAdded = added; - addAllInit(initList()); } /** @@ -70,27 +69,27 @@ public class FeatureListFragment extends BaseFragmentListFragment implements OnC ArrayList what = new ArrayList(); if(this.mInfo.containsKey(RingerDatabase.KEY_RINGTONE_IS_SILENT) || this.mInfo.containsKey(RingerDatabase.KEY_RINGTONE_VOLUME)){ - initFeatureFragment(KEY_ADDED_RINGTONE); + what.add(initFeatureFragment(KEY_ADDED_RINGTONE)); } if(this.mInfo.containsKey(RingerDatabase.KEY_NOTIFICATION_IS_SILENT) || this.mInfo.containsKey(RingerDatabase.KEY_NOTIFICATION_RINGTONE_VOLUME)){ - initFeatureFragment(KEY_ADDED_NOTIFICATIONTONE); + what.add(initFeatureFragment(KEY_ADDED_NOTIFICATIONTONE)); } if(this.mInfo.containsKey(RingerDatabase.KEY_ALARM_VOLUME)){ - initFeatureFragment(KEY_ADDED_ALARM_VOLUME); + what.add(initFeatureFragment(KEY_ADDED_ALARM_VOLUME)); } if(this.mInfo.containsKey(RingerDatabase.KEY_MUSIC_VOLUME)){ - initFeatureFragment(KEY_ADDED_MUSIC_VOLUME); + what.add(initFeatureFragment(KEY_ADDED_MUSIC_VOLUME)); } if(this.mInfo.containsKey(RingerDatabase.KEY_BT)){ - initFeatureFragment(KEY_ADDED_BT); + what.add(initFeatureFragment(KEY_ADDED_BT)); } if(this.mInfo.containsKey(RingerDatabase.KEY_WIFI)){ - initFeatureFragment(KEY_ADDED_WIFI); + what.add(initFeatureFragment(KEY_ADDED_WIFI)); } return what; } @@ -198,6 +197,7 @@ public class FeatureListFragment extends BaseFragmentListFragment implements OnC */ @Override public View onCreateView(LayoutInflater inflator, ViewGroup container, Bundle bundle) { + addAllInit(initList()); final View v = super.onCreateView(inflator, container, bundle); v.findViewById(R.id.add_feature_button).setOnClickListener(this); return v;