From dad8d319953c46f60e5e586bf5619b0f72e5a44b 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 --- .../com/wireguard/android/fragment/AppListDialogFragment.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'app/src') 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