How to update or refresh list when arraylist changes in listview
<p>i have use list-view and i have make a custom list by extending arrayaddapter class so when my array-list change or update then i want  that my adapter also change and adapter refresh list-view with new element. i have even use <code>myadapter.notifyDataSetChanged</code> but it doesn't work .so plz suggest me the solution of this problem</p>

<pre><code> Listview friendsuggestionlistview=(ListView) findViewById(R.id.suggestionlistview_id);   
 Adapter myadapter=new SuggestionDataAdapter(this,SuggestionWebParser.categorylist,SuggestionWebParser.itemlist,SuggestionWebParser.countlist,SuggestionWebParser.ratinglist);
         myadapter.notifyDataSetChanged();

 friendsuggestionlistview.setAdapter(myadapter);

    my custom adapter code

    public class SuggestionDataAdapter extends ArrayAdapter {
        ArrayList itemfilterarraylist,categoryfilterarraylist,countfilterarraylist,ratingfilterarraylist;
        ArrayList categoryarraylist,itemarraylist,countarraylist,ratingarraylist;
        private Context mcontext;   
        private View rowview;
        LayoutInflater inflater;

        public SuggestionDataAdapter(Context context, ArrayList&lt;String&gt; categoryadapterlist,ArrayList&lt;String&gt; itemadapterlist,ArrayList&lt;String&gt; countadapterlist,ArrayList&lt;String&gt; ratingadapterlist) {
            super(context, R.layout.friendsuggestionlayout,categoryadapterlist);
            // TODO Auto-generated constructor stub
        System.out.println("i m custom adapter------------");
            mcontext=context;

        itemfilterarraylist=new ArrayList&lt;String&gt;();
        categoryfilterarraylist=new ArrayList&lt;String&gt;();
        countfilterarraylist=new ArrayList&lt;String&gt;();
        ratingfilterarraylist=new ArrayList&lt;String&gt;();
        itemarraylist=new ArrayList&lt;String&gt;();
        categoryarraylist=new ArrayList&lt;String&gt;();
        ratingarraylist=new ArrayList&lt;String&gt;();
        countarraylist=new ArrayList&lt;String&gt;();

        itemarraylist.addAll(itemadapterlist);
        categoryarraylist.addAll(categoryadapterlist);
        countarraylist.addAll(countadapterlist);
        ratingarraylist.addAll(ratingadapterlist);

        itemfilterarraylist.addAll(this.itemarraylist);
        categoryfilterarraylist.addAll(this.categoryarraylist);
        countfilterarraylist.addAll(this.countarraylist);
        ratingfilterarraylist.addAll(this.ratingarraylist);

    inflater = (LayoutInflater) mcontext
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        System.out.println("the size of filter category is"+categoryfilterarraylist.size());
        }


        public View getView(final int position, View convertView, ViewGroup parent) {   
        try{
        String countvalue=(String) countfilterarraylist.get(position);
        String ratingvalue=(String) ratingfilterarraylist.get(position);

        int likes=Integer.parseInt(countvalue)+Integer.parseInt(ratingvalue)/2;
        int unlikes=Integer.parseInt(countvalue)-Integer.parseInt(ratingvalue);

    System.out.println("i m in new row view");

        rowview = inflater.inflate(R.layout.friendsuggestionlayout, parent, false);

    TextView textviewitemvalue = (TextView) rowview.findViewById(R.id.textView1);
    TextView textviewcategoryvlaue = (TextView) rowview.findViewById(R.id.textView2);
    TextView textviewcountvalue = (TextView) rowview.findViewById(R.id.textView3);
    Button likebtn=(Button) rowview.findViewById(R.id.likebtn_id); 
     Button unlikebtn=(Button) rowview.findViewById(R.id.button1); 
    System.out.println("i m in rowview");       
    System.out.println("the array list size is"+itemfilterarraylist.size());      
    textviewitemvalue.setText((CharSequence) itemfilterarraylist.get(position));  
    textviewcategoryvlaue.setText((CharSequence)( categoryfilterarraylist.get(position)));
    textviewcountvalue.setText("Like "+likes+"   Dislike "+unlikes);
          System.out.println("i before return row view");
        }
        catch(Exception e)
        {

            e.printStackTrace();
        }
          return rowview;
        }
    }
</code></pre>
