title: Error When getting List from a class
body: <p>I have a problem that, I have a serializable class which sets and gets multiple lists. I added a list into that but when I want to get that list from getter method it returns NullPointerException. That's why I mentioned here Error and Setter and Getter Methods for explaining the problem and How I retrive it.I don't know why and don't know how it will be removed? Can any one help me about this problem?</p>
  
  <p><strong>Error Stack:</strong></p>
  
  <pre><code>09-24 13:04:18.923: ERROR/AndroidRuntime(529): FATAL EXCEPTION: main
  09-24 13:04:18.923: ERROR/AndroidRuntime(529): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.equinix.android.common/com.equinix.android.showmyorders.ShowMyOrders}: java.lang.NullPointerException
  09-24 13:04:18.923: ERROR/AndroidRuntime(529):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
  09-24 13:04:18.923: ERROR/AndroidRuntime(529):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
  09-24 13:04:18.923: ERROR/AndroidRuntime(529):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
  09-24 13:04:18.923: ERROR/AndroidRuntime(529):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
  09-24 13:04:18.923: ERROR/AndroidRuntime(529):     at android.os.Handler.dispatchMessage(Handler.java:99)
  09-24 13:04:18.923: ERROR/AndroidRuntime(529):     at android.os.Looper.loop(Looper.java:123)
  09-24 13:04:18.923: ERROR/AndroidRuntime(529):     at android.app.ActivityThread.main(ActivityThread.java:4627)
  09-24 13:04:18.923: ERROR/AndroidRuntime(529):     at java.lang.reflect.Method.invokeNative(Native Method)
  09-24 13:04:18.923: ERROR/AndroidRuntime(529):     at java.lang.reflect.Method.invoke(Method.java:521)
  09-24 13:04:18.923: ERROR/AndroidRuntime(529):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
  09-24 13:04:18.923: ERROR/AndroidRuntime(529):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
  09-24 13:04:18.923: ERROR/AndroidRuntime(529):     at dalvik.system.NativeStart.main(Native Method)
  09-24 13:04:18.923: ERROR/AndroidRuntime(529): Caused by: java.lang.NullPointerException
  09-24 13:04:18.923: ERROR/AndroidRuntime(529):     at com.equinix.android.showmyorders.ShowMyOrders.onCreate(ShowMyOrders.java:87)
  09-24 13:04:18.923: ERROR/AndroidRuntime(529):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
  09-24 13:04:18.923: ERROR/AndroidRuntime(529):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
  09-24 13:04:18.923: ERROR/AndroidRuntime(529):     ... 11 more
  </code></pre>
  
  <p><strong>Class for Setting and Getting List:</strong></p>
  
  <pre><code>package com.equinix.android.model;
  
  import java.io.Serializable;
  import java.util.List;
  
  public class BaseIBXValues implements Serializable{
  
      private static final long serialVersionUID = 7526472295622776147L;
      private List&lt;String&gt; IBXId;
      private List&lt;String&gt; IBXName;
      private List&lt;String&gt; IBXNaturalKey;
  
      public List&lt;String&gt; getIBXId()
      {
          return IBXId;
      }
      public void setIBXId(List&lt;String&gt; IBXId)
      {
          this.IBXId = IBXId;
      }
  
      public List&lt;String&gt; getIBXName()
      {
          return IBXName;
      }
      public void setIBXName(List&lt;String&gt; IBXName)
      {
          this.IBXName = IBXName;
      }
  
      public List&lt;String&gt; getIBXNaturalKey()
      {
          return IBXNaturalKey;
      }
      public void setIBXNaturalKey(List&lt;String&gt; IBXNaturalKey)
      {
          this.IBXNaturalKey = IBXNaturalKey;
      }
  }
  
  
  **Code for Setting the value of arraylist:**
  public class Parse_Json {
  
      String json_String;
      List&lt;String&gt; IBXId;
      BaseIBXValues ibx;------&gt; It is the class where setter and getter mentioned
  
      public Parse_Json(String json_String)
      {
          this.json_String = json_String;
      }
  
      public void parse()
      {
          ibx = new BaseIBXValues();
          try{
          JSONObject ja = new JSONObject(json_String); 
  
          JSONArray  jo = ja.getJSONArray("ibx");
          for(int i=0;i&lt;jo.length();i++)
          {
              JSONObject j_data = jo.getJSONObject(i);
              System.out.println("The id is:"+j_data.getString("id"));
              IBXId.add(j_data.getString("id"));
              LoginScreen.id.add(j_data.getString("id"));
              System.out.println("The Name is:"+j_data.getString("name"));
              LoginScreen.name.add(j_data.getString("name"));
              System.out.println("The naturalKey is:"+j_data.getString("naturalKey"));
              LoginScreen.naturalKey.add(j_data.getString("naturalKey"));
  
          }
          }catch(Exception e)
          {
              e.printStackTrace();
          }
          ibx.setIBXId(IBXId);------------&gt; set the list
      }
  </code></pre>
  
  <p><strong>Get the List from Getter:</strong></p>
  
  <pre><code>ibx = new BaseIBXValues();
          ibId = ibx.getIBXId();
  
          for(int i=0;i&lt;6;i++)
          {
              System.out.println("The IBX ID:"+ibId.get(i));
          }   
  </code></pre>