I am working with fragments and libraries like slidingMenu, pullToRefreshListViews, and android Aquery.
In my app I want to fill up my ListView using a custom adapter with data I parse from JSON.

here's the rough code

```
public class MyFragment extends Fragment {

public MyFragment() {
    // Empty constructor required for fragment subclasses
}
    //initialize some variables here....
    PullToRefreshListView   list;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
final View rootView = inflater.inflate(//my layout xml, container, false);
aq = new AQuery(getActivity(),rootView);
list = (PullToRefreshListView) rootView.findViewById(R.id.list);
asyncJson(); // this method fetches,parses json and sets adapter to the listview
return rootView;
    }
}

```

the asyncJson() method is something like this.

```
public void asyncJson(){
    aq.ajax(url, JSONArray.class, expire, new AjaxCallback<JSONArray>() {

        @Override
        public void callback(String url, JSONArray json, AjaxStatus status) {
    try{
           // fetch and parse json store data in array<List>
        }
      if(adapter == null){
                adapter = new MyAdapter(getView().getContext(),//array<list> variables);
                list.setAdapter(adapter);

                }
                else if(adapter != null){

                    adapter.notifyDataSetChanged();

                }
    }
 });
}

```

Logcat gives me null pointer exception at `list.setAdapter(adapter);` this line. I have no syntax errors.
Is this because of the context I pass to the adapter I tried just getActivity() but that didn't work either
is the list null or the adapter? :0
what am I doing wrong?

Thanks! **[Logcat Image](http://i.imgur.com/gax9LuU.jpg)**

app project files: <https://www.dropbox.com/s/9sa1l8wm4rnmnew/stackoverflow.zip>