I am trying to create a list view inside a fragment. The array which is causing a null pointer exception is being taken from a separate class called "getData". 

To create the list view i am using the Custom List Adapter. It is only when I put the array into the custom list adapter that i get the error.

**Fragment where error evolves:**

```
package com.example.testapp;

import android.os.Bundle;

public class FragmentA extends Fragment {
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View V = inflater.inflate(R.layout.fragment_a, container, false);

    ListView listView = (ListView)V.findViewById(R.id.list);

        Integer[] imageId = {
                R.drawable.ic_launcher,
                R.drawable.ic_launcher,
               };

        getData data = getData.getMyData();

      CustomList adapter = new
            CustomList(getActivity(), data.myArray, imageId); //This is where i put the array.      
      listView.setAdapter(adapter);

    return V;
}
}

```

**getData class (where the array is taken from):**

```
package com.example.testapp;

import java.io.BufferedReader;

public class getData{ 

    private static getData _instance; 

    public String myArray[]; //Array set up

    public static getData getMyData() //This is what the fragment calls to get the array.
    {
        if(_instance == null)
            _instance = new getData();

        return _instance;
    }

public void runData(){
       getData data = getData.getMyData();

       data.myArray[0] = "test"; //Array given value

}

}

```