title: NotifyDatasetChanged not working on a custom Adapter
body: <p>I'm trying to fill a ListView with a custom Adapter.<br>
  I want to use the NotifyDatasetChanged to refresh the layout, but it doesn't work.<br>
  I retrieve some JSON data from an HTTP request, and I manipulate the result string then I fill the ListView</p>
  
  <p>What's wrong in my code?
  <strong>UPDATE THE CODE</strong> (For the advice)</p>
  
  <pre><code>public class CalendarioFragment extends Fragment {
      ListView listView;
      ArrayList&lt;Calendario&gt; calenList;
      CalendarioAdapter adapter;
      String json;
      ArrayList&lt;String&gt; arrayId = new ArrayList&lt;String&gt;();
      ArrayList&lt;String&gt; arrayData = new ArrayList&lt;String&gt;();
  
      @Nullable
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
          View view = inflater.inflate(R.layout.calendario_layout, null);
  
          listView = (ListView) view.findViewById(R.id.listCale);
          listView.setEmptyView(view.findViewById(R.id.emptyElement));
  
          calenList = new ArrayList&lt;Calendario&gt;();
          adapter = new CalendarioAdapter(getActivity(), calenList);
          listView.setAdapter(adapter);
  
          execQuery("query", "0");
  
          return view;
      }
  
      private void execQuery(final String query, final String taskId) {
          final MyAsyncTask asyncTask = new MyAsyncTask(new AsyncResponse() {
              @Override
              public void onTaskCompleted(String output) {
  
                  if (output == null) {
                      Toast.makeText(getActivity(), "Nessuna connessione internet attiva!", Toast.LENGTH_SHORT).show();
                  } else {
                      json = output;
  
                      try {
                          ParseJson();
                          calenList.clear();
  
                          String[] ids = arrayId.toArray(new String[arrayId.size()]);
                          String[] date = arrayData.toArray(new String[arrayData.size()]);
  
                          for (int i = 0; i &lt; ids.length; i++) {
                              Calendario calendario = new Calendario();
                              calendario.setId(ids[i]);
                              calendario.setData(date[i]);
  
                              calenList.add(calendario);
                              adapter.updateData(calenList);
                          }
  
                      } catch (JSONException e) {
                          e.printStackTrace();
                      }
                  }
              }
          }, getActivity());
  
          asyncTask.execute(query, taskId);
      }
  
      private void ParseJson() throws JSONException {
          JSONObject jsonObject = new JSONObject(json);
          JSONArray jsonArray = jsonObject.getJSONArray("risposta");
  
          for (int i = 0; i &lt; jsonArray.length(); i++) {
              JSONObject JO = jsonArray.getJSONObject(i);
              arrayId.add(JO.getString("ID"));
              arrayData.add(JO.getString("DATA"));
          }
      }
  }
  </code></pre>
  
  <p>This is the CustomAdapterCode:</p>
  
  <pre><code>import android.content.Context;
  import android.graphics.Color;
  import android.util.Log;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.BaseAdapter;
  import android.widget.TextView;
  
  import java.util.ArrayList;
  
  public class CalendarioAdapter extends BaseAdapter {
      private ArrayList listData;
      private LayoutInflater layoutInflater;
      final static String TAG = "sb.dl";
  
      public CalendarioAdapter(Context context, ArrayList listData) {
          Log.d(TAG, "CalendarioAdapter");
          this.listData = listData;
          layoutInflater = LayoutInflater.from(context);
      }
  
      @Override
      public int getCount() {
          return listData.size();
      }
  
      @Override
      public Object getItem(int position) {
          return listData.get(position);
      }
  
      @Override
      public long getItemId(int position) {
          return position;
      }
  
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
          Log.d(TAG, "CalendarioAdapter.getView");
          ViewHolder holder;
  
          if (convertView == null) {
              convertView = layoutInflater.inflate(R.layout.calendario_row_layout, null);
              holder = new ViewHolder();
              holder.edId = (TextView) convertView.findViewById(R.id.edId);
              holder.edData = (TextView) convertView.findViewById(R.id.edData);
  
              convertView.setTag(holder);
          } else {
              holder = (ViewHolder) convertView.getTag();
          }
  
          Calendario newsItem = (Calendario) listData.get(position);
          holder.edId.setText(newsItem.getId());
          holder.edData.setText(newsItem.getData());
  
          return convertView;
      }
  
      static class ViewHolder {
          TextView edId;
          TextView edData;
      }
  
  public void updateData(ArrayList&lt;Calendario&gt; updatedData) {
      listData = updatedData;
      this.notifyDataSetChanged();
  }
  }
  </code></pre>