title: java.lang.NullPointerException: storage == null
body: <p>When I want to open an item in a listview that has been ticked. I receive the error:</p>
  
  <blockquote>
    <p>java.lang.NullPointerException: storage == null</p>
  </blockquote>
  
  <p>I use the volley libary for http requests. Here I make the request, And use another class for converting the json in an array. </p>
  
  <pre><code>public class Tips extends AppCompatActivity {
  
  private SQLiteDatabase db;
  public static final String INFORMATION_TIPS = "http://www.mydomainname/login/api.php?action=getTips";
  public final String TIP = "tip";
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_tips);
      setTitle("Tips");
      populateListView();
      ListView tipsView = (ListView) findViewById(R.id.tipsView);
      tipsView.setOnItemClickListener(
              new AdapterView.OnItemClickListener() {
                  @Override
                  public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
                      String tip = String.valueOf(parent.getItemAtPosition(position));
                      //userData data = new userData(db);
                      try {
                      tipsViewPost(tip);
                      Intent singleTipIntent = new Intent(Tips.this,singleTip.class);
                      startActivity(singleTipIntent);
                      }
                      catch (Exception ex)
                      {
                          Toast.makeText(Tips.this, ex.getLocalizedMessage(), Toast.LENGTH_SHORT).show();
                      }
  
                  }
              }
      );
  }
  
  private void populateListView()
  {
      try {
          //lijst van items
          String[] tips = {"Hoofd", "knie"};
  
          //adapter maken
          ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, tips);
  
          //list koppelen aan adapter
          ListView list = (ListView) findViewById(R.id.tipsView);
          list.setAdapter(adapter);
      }
      catch(Exception ex)
      {
          Toast.makeText(Tips.this, ex.getLocalizedMessage(), Toast.LENGTH_SHORT).show();
      }
  }
  
  public void tipsViewPost(String tipView) {
      final String tip = tipView;
      try {
          StringRequest stringRequest = new StringRequest(Request.Method.POST, INFORMATION_TIPS,
                  new Response.Listener&lt;String&gt;() {
                      @Override
                      public boolean onResponse(String response) throws JSONException {
                          setTipsJson(response,tip);
                          return true;
                      }
                  },
                  new Response.ErrorListener() {
                      @Override
                      public boolean onErrorResponse(VolleyError error) {
                          try {
                              Toast.makeText(Tips.this, error.getMessage(), Toast.LENGTH_LONG).show();
                              return false;
                          }
                          catch(Exception ex)
                          {
                              Toast.makeText(Tips.this, ex.getLocalizedMessage(), Toast.LENGTH_SHORT).show();
                          }
                          return false;
                      }
                  }) {
              @Override
              protected Map&lt;String, String&gt; getParams() throws AuthFailureError {
                  Map&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();
                  map.put(TIP, tip);
                  return map;
              }
          };
          RequestQueue requestQueue = Volley.newRequestQueue(this);
          requestQueue.add(stringRequest);
      } catch (Exception ex) {
          Toast.makeText(Tips.this, ex.getLocalizedMessage(), Toast.LENGTH_SHORT).show();
      }
  }
  
  protected void setTipsJson(String json,String tip)
  {
      try {
          parseJSON pj = new parseJSON(json);
          pj.parseTips(tip);
      }
      catch(Exception ex)
      {
          Toast.makeText(Tips.this, ex.getLocalizedMessage(), Toast.LENGTH_SHORT).show();
      }
  }
  </code></pre>
  
  <p>This is my Json class where I receive it and put it in an array:</p>
  
  <pre><code>  public static String[] injuries;
    private JSONArray tipsJson = null;
  
        protected  void parseTips(String injurie) {
          JSONObject jsonObject = null;
          String value = "naam";
          try {
              jsonObject = new JSONObject(json);
              tipsJson = jsonObject.getJSONArray(injurie);
  
              injuries = new String[tipsJson.length()];
  
              for (int i = 0; i &lt; tipsJson.length(); i++) {
                  JSONObject jo = tipsJson.getJSONObject(i);
                  injuries[i] = jo.getString(value);
              }
          } catch (JSONException e) {
              e.printStackTrace();
          }
      }
  </code></pre>
  
  <p>I have now Idea why it throws that exception. </p>
  
  <p>THIS IS MY ENTIRE ERROR:</p>
  
  <blockquote>
    <p>10-29 22:35:09.547 7603-7603/com.example.mydomain.fysio
    E/MotionRecognitionManager: mSContextService =
    android.hardware.scontext.ISContextService$Stub$Proxy@283f51f8 10-29
    22:35:09.547 7603-7603/com.example.mydomain.fysio
    E/MotionRecognitionManager: motionService =
    com.samsung.android.motion.IMotionRecognitionService$Stub$Proxy@bbfa6d1
    10-29 22:35:09.547 7603-7603/com.example.mydomain.fysio
    E/MotionRecognitionManager: motionService =
    com.samsung.android.motion.IMotionRecognitionService$Stub$Proxy@bbfa6d1
    10-29 22:35:09.547 7603-7603/com.example.mydomain.fysio
    D/AndroidRuntime: Shutting down VM 10-29 22:35:09.547
    7603-7603/com.example.mydomain.fysio E/AndroidRuntime: FATAL
    EXCEPTION: main 10-29 22:35:09.547
    7603-7603/com.example.mydomain.fysio E/AndroidRuntime: Process:
    com.example.mydomain.fysio, PID: 7603 10-29 22:35:09.547
    7603-7603/com.example.mydomain.fysio E/AndroidRuntime:
    java.lang.RuntimeException: Unable to start activity
    ComponentInfo{com.example.mydomain.fysio/com.example.mydomain.fysio.singleTip}:
    java.lang.NullPointerException: storage == null 10-29 22:35:09.547
    7603-7603/com.example.mydomain.fysio E/AndroidRuntime:     at
    android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3149)
    10-29 22:35:09.547 7603-7603/com.example.mydomain.fysio
    E/AndroidRuntime:     at
    android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3248)
    10-29 22:35:09.547 7603-7603/com.example.mydomain.fysio
    E/AndroidRuntime:     at
    android.app.ActivityThread.access$1000(ActivityThread.java:197) 10-29
    22:35:09.547 7603-7603/com.example.mydomain.fysio E/AndroidRuntime:<br>
    at
    android.app.ActivityThread$H.handleMessage(ActivityThread.java:1681)
    10-29 22:35:09.547 7603-7603/com.example.mydomain.fysio
    E/AndroidRuntime:     at
    android.os.Handler.dispatchMessage(Handler.java:102) 10-29
    22:35:09.547 7603-7603/com.example.mydomain.fysio E/AndroidRuntime:<br>
    at android.os.Looper.loop(Looper.java:145) 10-29 22:35:09.547
    7603-7603/com.example.mydomain.fysio E/AndroidRuntime:     at
    android.app.ActivityThread.main(ActivityThread.java:6872) 10-29
    22:35:09.547 7603-7603/com.example.mydomain.fysio E/AndroidRuntime:<br>
    at java.lang.reflect.Method.invoke(Native Method) 10-29 22:35:09.547
    7603-7603/com.example.mydomain.fysio E/AndroidRuntime:     at
    java.lang.reflect.Method.invoke(Method.java:372) 10-29 22:35:09.547
    7603-7603/com.example.mydomain.fysio E/AndroidRuntime:     at
    com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
    10-29 22:35:09.547 7603-7603/com.example.mydomain.fysio
    E/AndroidRuntime:     at
    com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199) 10-29
    22:35:09.547 7603-7603/com.example.mydomain.fysio E/AndroidRuntime: 
    Caused by: java.lang.NullPointerException: storage == null 10-29
    22:35:09.547 7603-7603/com.example.mydomain.fysio E/AndroidRuntime:<br>
    at java.util.Arrays$ArrayList.(Arrays.java:38) 10-29
    22:35:09.547 7603-7603/com.example.mydomain.fysio E/AndroidRuntime:<br>
    at java.util.Arrays.asList(Arrays.java:155) 10-29 22:35:09.547
    7603-7603/com.example.mydomain.fysio E/AndroidRuntime:     at
    android.widget.ArrayAdapter.(ArrayAdapter.java:128) 10-29
    22:35:09.547 7603-7603/com.example.mydomain.fysio E/AndroidRuntime:<br>
    at
    com.example.mydomain.fysio.singleTip.populateListView(singleTip.java:20)
    10-29 22:35:09.547 7603-7603/com.example.mydomain.fysio
    E/AndroidRuntime:     at
    com.example.mydomain.fysio.singleTip.onCreate(singleTip.java:14) 10-29
    22:35:09.547 7603-7603/com.example.mydomain.fysio E/AndroidRuntime:<br>
    at android.app.Activity.performCreate(Activity.java:6550) 10-29
    22:35:09.547 7603-7603/com.example.mydomain.fysio E/AndroidRuntime:<br>
    at
    android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1120)
    10-29 22:35:09.547 7603-7603/com.example.mydomain.fysio
    E/AndroidRuntime:     at
    android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3102)
    10-29 22:35:09.547 7603-7603/com.example.mydomain.fysio
    E/AndroidRuntime:     at
    android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3248) 
    10-29 22:35:09.547 7603-7603/com.example.mydomain.fysio
    E/AndroidRuntime:     at
    android.app.ActivityThread.access$1000(ActivityThread.java:197)  10-29
    22:35:09.547 7603-7603/com.example.mydomain.fysio E/AndroidRuntime:<br>
    at
    android.app.ActivityThread$H.handleMessage(ActivityThread.java:1681) 
    10-29 22:35:09.547 7603-7603/com.example.mydomain.fysio
    E/AndroidRuntime:     at
    android.os.Handler.dispatchMessage(Handler.java:102)  10-29
    22:35:09.547 7603-7603/com.example.mydomain.fysio E/AndroidRuntime:<br>
    at android.os.Looper.loop(Looper.java:145)  10-29 22:35:09.547
    7603-7603/com.example.mydomain.fysio E/AndroidRuntime:     at
    android.app.ActivityThread.main(ActivityThread.java:6872)  10-29
    22:35:09.547 7603-7603/com.example.mydomain.fysio E/AndroidRuntime:<br>
    at java.lang.reflect.Method.invoke(Native Method)  10-29 22:35:09.547
    7603-7603/com.example.mydomain.fysio E/AndroidRuntime:     at
    java.lang.reflect.Method.invoke(Method.java:372)  10-29 22:35:09.547
    7603-7603/com.example.mydomain.fysio E/AndroidRuntime:     at
    com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404) 
    10-29 22:35:09.547 7603-7603/com.example.mydomain.fysio
    E/AndroidRuntime:     at
    com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)  10-29
    22:35:10.787 7603-10109/com.example.mydomain.fysio E/Volley: [11248]
    BasicNetwork.performRequest: Unexpected response code 404 for
    http:mydomain/login/api.php?action=getTips</p>
  </blockquote>
  
  <p>EDIT:</p>
  
  <pre><code>package com.example.mydomain.fysio;
  
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.widget.ArrayAdapter;
  import android.widget.ListView;
  
  public class singleTip extends AppCompatActivity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_single_tip);
          populateListView();
      }
  
      public void populateListView()
      {
          //adapter maken
  </code></pre>
  
  <p>//line20  ArrayAdapter adapter = new ArrayAdapter        ( //line20 (this,android.R.layout.simple_list_item_1,parseJSON.injuries);</p>
  
  <pre><code>        //list koppelen aan adapter
          ListView list = (ListView) findViewById(R.id.singleTip);
          list.setAdapter(adapter);
      }
  }
  </code></pre>