Arrayindexoutofboundsexception ArrayList customListView
<p>I have a question regarding my customListview in android. I am trying to add content dynamically in the list using onclick event (tv.setOnClickListener), i have my custome country class in whcih i store my data using geter and seter method. 
Problem: When i add new content dynamically and scrolldown to the end of the list i get Arrayindexoutofboundexception </p>

<p>plz help </p>

<pre><code> public class PosterList extends Activity 
   {

 MyCustomAdapter dataAdapter = null;
ArrayList&lt;Country&gt; countryList = new ArrayList&lt;Country&gt;();

TextView tv;

@Override
public void onCreate(Bundle savedInstanceState) 
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.posterlist);

            //Click on textview to add element in contrylist

    tv = (TextView) findViewById(R.id.myFilter);
    tv.setOnClickListener(new View.OnClickListener() 
    {
            public void onClick(View v) 
            {
                Country country = new Country("df","df","df","m");
                countryList.add(country);      
                dataAdapter.notifyDataSetChanged();
            }
    });

    displayListView();

}

private void displayListView() 
{

            //Parse my JSON and store it in to different arrays

    for(int k=0;k&lt;len;k++)
    {
        Country country = new Country(subcategory[k],caseid[k],time[k],newpost[k]);
        countryList.add(country);
    }

    dataAdapter = new MyCustomAdapter(this,R.layout.country_info, countryList);
    ListView listView = (ListView) findViewById(R.id.listView1);
    listView.setAdapter(dataAdapter);

    listView.setOnItemClickListener(new OnItemClickListener()
    {
        public void onItemClick(AdapterView&lt;?&gt; parent, View view,
            int position, long id) 
        {

                Country country = (Country) parent.getItemAtPosition(position);
                Toast.makeText(getApplicationContext(),
                country.getContinent(), Toast.LENGTH_SHORT).show();

        }
    });


}

private class MyCustomAdapter extends ArrayAdapter&lt;Country&gt; 
{

    private ArrayList&lt;Country&gt; originalList;
    private ArrayList&lt;Country&gt; countryList;

    public MyCustomAdapter(Context context, int textViewResourceId, 
        ArrayList&lt;Country&gt; countryList) {
    super(context, textViewResourceId, countryList);
    this.countryList = new ArrayList&lt;Country&gt;();
    this.countryList.addAll(countryList);
    this.originalList = new ArrayList&lt;Country&gt;();
    this.originalList.addAll(countryList);
}

private class ViewHolder 
{
    TextView code;
    TextView name;
    TextView continent;
    TextView region;
 }

@Override
public View getView(int position, View convertView, ViewGroup parent) 
{

    ViewHolder holder = null;
    Log.v("ConvertView", String.valueOf(position));
    if (convertView == null) 
    {

        LayoutInflater vi = (LayoutInflater)getSystemService(
            Context.LAYOUT_INFLATER_SERVICE);
        convertView = vi.inflate(R.layout.country_info, null);

        holder = new ViewHolder();
        holder.code = (TextView) convertView.findViewById(R.id.code);
        holder.name = (TextView) convertView.findViewById(R.id.name);
        holder.continent = (TextView) convertView.findViewById(R.id.continent);
        holder.region = (TextView) convertView.findViewById(R.id.region);

        convertView.setTag(holder);

    } 
    else
     {
            holder = (ViewHolder) convertView.getTag();
     }

    Country country = countryList.get(position);
    holder.code.setText(country.getCode());
    holder.name.setText(country.getName());
    holder.continent.setText(country.getContinent());
    holder.region.setText(country.getRegion());

    return convertView;

  }
   }
}
</code></pre>
