title: notifyDataSetChanged not working in android
body: <p>The list view is not updating data when the notifyDataChanged() method called.</p>
  
  <p>In onCreate() method i initialized the the listview with no data.</p>
  
  <pre><code>            ListView videoList = (ListView)findViewById(R.id.videos_list);
      videoList.setOnItemClickListener(listener);
      listAdapter = new PHVideosListAdapter(PHVideosActivity.this, videos);
      videoList.setAdapter(listAdapter);
  </code></pre>
  
  <p>After this I started fetching list of video using new VideosCategoryFetchTask().execute();</p>
  
  <p>in the post execute method I called </p>
  
  <pre><code>            @Override
      protected void onPostExecute(Boolean success) {
          if(success) {
               listAdapter.notifyDataSetChanged();
          } else {
              //show dialog
          }
      }
  </code></pre>
  
  <p>but nothing is displayed on the list. If anybody knew the solution please help...</p>
  
  <pre><code> private class VideosDetailsFetchTask extends AsyncTask&lt;String, Void, Boolean&gt; {
      @Override
      public void onPreExecute() {
          super.onPreExecute();
      }
  
      @Override
      protected Boolean doInBackground(String... params) {
          Boolean success = false;
          try {
              if (params.length &gt;= 0) {
                  videos = (Videos)videoAPI.videosForCategoryId(params[0],new VideosParser());
                  success = true;
              }
          } catch (Exception e) {
              // TODO: handle exception
          }
          return success;
      }
  
      @Override
      protected void onPostExecute(Boolean success) {
  
          if(success) {
                progressBar.setVisibility(View.INVISIBLE);
                onFinishVideoFetch();
          } else {
              //show dialog   
          }       
      }
  }
  </code></pre>
  
  <p>here  using two Async classes sec one is called on the onPostExecute() of first one..</p>
  
  <pre><code>   private void onFinishVideoFetch() {
      if(videos != null) {
  
          listAdapter.notifyDataSetChanged();
      }
  }
  </code></pre>
  
  <p>I 'm not fetching videos one by one.. here a list of videos is returned....</p>
  
  <p>After getting the list of videos i wanted to refresh the list.</p>
  
  <pre><code>@Override
  protected void onProgressUpdate(Videos... values) {
  
      videos = values[0];
   //add published object to list which holds
      listAdapter.notifyDataSetChanged();
  
  
  }
  </code></pre>
  
  <p>I tried this but no luck please help..</p>
  
  <p>this is the adapter class used</p>
  
  <p>public class PHVideosListAdapter extends BaseAdapter{</p>
  
  <pre><code>private Videos videoTitles;
  private LayoutInflater inflater;
  
  public PHVideosListAdapter(Context context, Videos videoTitles) {
  
      inflater = LayoutInflater.from(context);
      this.videoTitles = videoTitles;
  }
  
  @Override
  public int getCount() {
      // TODO Auto-generated method stub
      if(videoTitles != null) {
          return videoTitles.size();
      }
      else {
          return 0;
      }
  }
  
  @Override
  public Object getItem(int position) {
      // TODO Auto-generated method stub
      return videoTitles.get(position);
  }
  
  @Override
  public long getItemId(int position) {
      // TODO Auto-generated method stub
      return position;
  }
  
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
      // TODO Auto-generated method stub
      VideoListViewHolder holder = null;
  
      if (convertView == null) {
  
              holder = new VideoListViewHolder();
              convertView = inflater.inflate(R.layout.videos_list, null);
              holder.videoTitle = (TextView) convertView.findViewById(R.id.video_title);
              holder.videoImage = (ImageView) convertView.findViewById(R.id.video_image);
              holder.videoDuration = (TextView) convertView.findViewById(R.id.video_duration);
  
              convertView.setTag(holder);
      } else {
          holder = (VideoListViewHolder)convertView.getTag();
      }
  
      holder.videoImage.setImageResource(R.drawable.icon);
      holder.videoDuration.setText("00:10");
      holder.videoTitle.setText(videoTitles.get(position).getVideoTitle());
      return convertView;
  }
  
  
     private class VideoListViewHolder {
  
       ImageView videoImage;
       TextView  videoTitle;
       TextView  videoDuration;
  }
  </code></pre>
  
  <p>}</p>