From 28d47b347021671f089fe84ca1da3e7d8b7ace7f Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Wed, 18 Jul 2018 18:08:08 +0200 Subject: AppListDialogFragment: getArguments is null before onCreate Signed-off-by: Jason A. Donenfeld --- .../com/wireguard/android/fragment/AppListDialogFragment.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'app/src/main') 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 currentlyExcludedApps = Arrays.asList(getArguments().getStringArray(KEY_EXCLUDED_APPS)); + private List currentlyExcludedApps; private final ObservableKeyedList appData = new ObservableKeyedArrayList<>(); public static AppListDialogFragment newInstance(final String[] excludedApps, final T target) { @@ -51,6 +51,13 @@ public class AppListDialogFragment extends DialogFragment { return fragment; } + @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()); -- cgit v1.2.3