getStringArrayExtra() returns null
<p>I am trying to create an android app on android studio which scans WIFI signals, and passes all the WIFI signal SSIDs containing "WDT_" to another intent.</p>

<p>When I run the app, it crashes due to a NPE.
I debugged the app, and it says that intent.getStringArrayExtra() in MultipleWifi.java is null.</p>

<p>Am I doing something wrong with passing the string array?</p>

<p>MainActivity.java:</p>

<pre><code>protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    WifiManager wifiManager = (WifiManager) this.getSystemService(Context.WIFI_SERVICE);
    WifiConfiguration conf = new WifiConfiguration();

    int WDTWifiCount = 0;
    List&lt;ScanResult&gt; results = wifiManager.getScanResults();
    for (ScanResult scanResult : results) {
        if (scanResult.SSID.contains("WDT_")) {
            SSIDString[0] = (scanResult.SSID);
            WDTWifiCount++;
        }
    }

    WDTWifiCount = 2;
    SSIDString[0] = "WDT_12345";
    SSIDString[1] = "WDT_14445";

    if (WDTWifiCount &lt; 1) {
        startActivity(new Intent(this, NoWifi.class));
    } else if (WDTWifiCount &gt; 1) {
        Intent intent = new Intent(this, MultipleWifi.class);
        intent.putExtra("SSIDList", SSIDString);
        startActivityForResult(intent, 1);
    }

    conf.SSID = "\"" + networkSSID + "\"";
    conf.preSharedKey = "\"" + networkPass + "\"";

    WDTWifiCount = 0;
    wifiManager.addNetwork(conf);

    List&lt;WifiConfiguration&gt; list = wifiManager.getConfiguredNetworks();
    for (WifiConfiguration i : list) {
        if (i.SSID != null &amp;&amp; i.SSID.equals("\"" + networkSSID + "\"") &amp;&amp; WDTWifiCount != 0) {
            wifiManager.disconnect();
            wifiManager.enableNetwork(i.networkId, true);
            wifiManager.reconnect();

            break;
        }
    }

    myWebView = new WebView(this);
    myWebView.setWebViewClient(new WebViewClient() {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            view.loadUrl(url);
            return true;
        }
    });
    WebSettings webSettings = myWebView.getSettings();
    webSettings.setJavaScriptEnabled(true);
    webSettings.setLoadWithOverviewMode(true);
    webSettings.setUseWideViewPort(true);
    webSettings.setSupportZoom(true);
    webSettings.setBuiltInZoomControls(true);
    myWebView.setWebChromeClient(new WebChromeClient());
    myWebView.loadUrl("http://192.168.1.1/index.html");
}
</code></pre>

<p>MultipleWifi.java:</p>

<pre><code>protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.multiplewifi);

    Intent intent = getIntent();
    final String[] StringSSID = intent.getStringArrayExtra("SSIDstring");
    List&lt;String&gt; SSIDList = new ArrayList&lt;String&gt;(Arrays.asList(StringSSID));

    final Spinner spinner = (Spinner) findViewById(R.id.spinner);
    ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_spinner_item, SSIDList);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spinner.setAdapter(adapter);

    Button button = (Button) findViewById(R.id.button);
    button.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            String SSID = spinner.getSelectedItem().toString();
            Intent intent = new Intent();
            intent.putExtra("SSID", SSID);
            setResult(RESULT_OK, intent);
            finish();
        }
    });
}
</code></pre>

<p>Debug:</p>

<pre><code>E/AndroidRuntime: FATAL EXCEPTION: main
              Process: com.example.wdt, PID: 9031
              java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.wdt/com.example.wdt.MultipleWifi}: java.lang.NullPointerException: storage == null
                  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2200)
                  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2250)
                  at android.app.ActivityThread.access$800(ActivityThread.java:139)
                  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1200)
                  at android.os.Handler.dispatchMessage(Handler.java:102)
                  at android.os.Looper.loop(Looper.java:136)
                  at android.app.ActivityThread.main(ActivityThread.java:5105)
                  at java.lang.reflect.Method.invokeNative(Native Method)
                  at java.lang.reflect.Method.invoke(Method.java:515)
                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)
                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:608)
                  at dalvik.system.NativeStart.main(Native Method)
               Caused by: java.lang.NullPointerException: storage == null
                  at java.util.Arrays$ArrayList.&lt;init&gt;(Arrays.java:38)
                  at java.util.Arrays.asList(Arrays.java:155)
                  at com.example.wdt.MultipleWifi.onCreate(MultipleWifi.java:23)
                  at android.app.Activity.performCreate(Activity.java:5275)
                  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
                  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2164)
                  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2250) 
                  at android.app.ActivityThread.access$800(ActivityThread.java:139) 
                  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1200) 
                  at android.os.Handler.dispatchMessage(Handler.java:102) 
                  at android.os.Looper.loop(Looper.java:136) 
                  at android.app.ActivityThread.main(ActivityThread.java:5105) 
                  at java.lang.reflect.Method.invokeNative(Native Method) 
                  at java.lang.reflect.Method.invoke(Method.java:515) 
                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792) 
                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:608) 
                  at dalvik.system.NativeStart.main(Native Method) 
</code></pre>

<p>EDIT: After editing the key in "intent.putExtra" to SSIDString it still returns null.</p>

<p>Debug:</p>

<pre><code>E/AndroidRuntime: FATAL EXCEPTION: main
              Process: com.example.wdt, PID: 31443
              java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.wdt/com.example.wdt.MultipleWifi}: java.lang.NullPointerException: storage == null
                  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2200)
                  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2250)
                  at android.app.ActivityThread.access$800(ActivityThread.java:139)
                  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1200)
                  at android.os.Handler.dispatchMessage(Handler.java:102)
                  at android.os.Looper.loop(Looper.java:136)
                  at android.app.ActivityThread.main(ActivityThread.java:5105)
                  at java.lang.reflect.Method.invokeNative(Native Method)
                  at java.lang.reflect.Method.invoke(Method.java:515)
                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)
                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:608)
                  at dalvik.system.NativeStart.main(Native Method)
               Caused by: java.lang.NullPointerException: storage == null
                  at java.util.Arrays$ArrayList.&lt;init&gt;(Arrays.java:38)
                  at java.util.Arrays.asList(Arrays.java:155)
                  at com.example.wdt.MultipleWifi.onCreate(MultipleWifi.java:23)
                  at android.app.Activity.performCreate(Activity.java:5275)
                  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
                  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2164)
                  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2250) 
                  at android.app.ActivityThread.access$800(ActivityThread.java:139) 
                  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1200) 
                  at android.os.Handler.dispatchMessage(Handler.java:102) 
                  at android.os.Looper.loop(Looper.java:136) 
                  at android.app.ActivityThread.main(ActivityThread.java:5105) 
                  at java.lang.reflect.Method.invokeNative(Native Method) 
                  at java.lang.reflect.Method.invoke(Method.java:515) 
                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792) 
                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:608) 
                  at dalvik.system.NativeStart.main(Native Method) 
</code></pre>