diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-07-18 18:08:08 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-07-18 18:08:08 +0200 |
commit | 28d47b347021671f089fe84ca1da3e7d8b7ace7f (patch) | |
tree | a79dcc927ba0fa5258051d402e42f8b73865e6ae | |
parent | 8e3586328c867c135ff455c19a6f751b89ae0197 (diff) |
AppListDialogFragment: getArguments is null before onCreate
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r-- | app/src/main/java/com/wireguard/android/fragment/AppListDialogFragment.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/app/src/main/java/com/wireguard/android/fragment/AppListDialogFragment.java b/app/src/main/java/com/wireguard/android/fragment/AppListDialogFragment.java index 50de0c39..76a8c97c 100644 --- a/app/src/main/java/com/wireguard/android/fragment/AppListDialogFragment.java +++ b/app/src/main/java/com/wireguard/android/fragment/AppListDialogFragment.java @@ -39,7 +39,7 @@ public class AppListDialogFragment extends DialogFragment { private static final String KEY_EXCLUDED_APPS = "excludedApps"; - private final List<String> currentlyExcludedApps = Arrays.asList(getArguments().getStringArray(KEY_EXCLUDED_APPS)); + private List<String> currentlyExcludedApps; private final ObservableKeyedList<String, ApplicationData> appData = new ObservableKeyedArrayList<>(); public static <T extends Fragment & AppExclusionListener> AppListDialogFragment newInstance(final String[] excludedApps, final T target) { @@ -52,6 +52,13 @@ public class AppListDialogFragment extends DialogFragment { } @Override + public void onCreate(@Nullable final Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + currentlyExcludedApps = Arrays.asList(getArguments().getStringArray(KEY_EXCLUDED_APPS)); + } + + @Override public Dialog onCreateDialog(final Bundle savedInstanceState) { final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(getActivity()); alertDialogBuilder.setTitle(R.string.excluded_applications); |