run onresume() method when i change tab "ontabchange()" in a view
<p>I put the code in <code>onResume()</code> method for it to run each time when i load it again by tab click but problem is now that data load first time from server in to list view when I click first time on tab and when I change the tab and load it again it  force close and gives "array index out of bound exception". I think it  is because it not removes previous loaded data and so  how to remove or reload new data on tab click so that exception not occur? This means before loading new data via <code>onResume()</code> how to delete old data?</p>

<p>protected void onPause() {
         super.onPause();</p>

<pre><code> }


 protected void onResume()
{

   super.onResume();

   **new ProgressTask6().execute();**

}

private class ProgressTask6 extends AsyncTask&lt;String, Void, Boolean&gt; {
 private ProgressDialog dialog;
            private Context context;
            @Override
            protected void onPreExecute() {
                 dialog = new ProgressDialog(OpeningToday.this);
                 dialog.setMessage("Processing...");
                 dialog.setIndeterminate(true);
                 dialog.setCancelable(false);
                 dialog.show();
        }

            @Override
        protected void onPostExecute(final Boolean success) {

                if (dialog.isShowing())
                {
                dialog.dismiss();
                setListAdapter(new MyAdapter(OpeningToday.this));
            }


     }
        @Override
        protected Boolean doInBackground(String... args) {
              try{ 


         } catch (Exception e){
           Log.e("tag", "error", e);
           return false;
        }
        return null;
       }
        class MyAdapter extends BaseAdapter implements OnClickListener
        {


                    }        

                    @Override
                    public int getCount() {
                       }                        }

                    /* Not implemented but not really needed */
                    @Override
                    public Object getItem(int position) {
                        return null;
                    }

                    /* Not implemented but not really needed */
                    @Override
                    public long getItemId(int position) { 
                        return 0;
                    }

                    @Override
                    public View getView(int position, View ConvertView, ViewGroup parent) 
                    {
                        View v = inflater.inflate(R.layout.listitem_layout, parent, false);
                       // Log.i("array galoijewdh..",keywordresulttab.array_galleryname[position]);
                        Log.i("saurabh trivedi","saurabh trivedui");
                       // Variables.a=3;
                        String   gallerynames = keywordresulttab.array_galleryname[position];
                        String  addresses = keywordresulttab.array_address[position];            
                        TextView tv = (TextView) v.findViewById(R.id.barrio);
                        tv.setText(gallerynames);
                        tv = (TextView) v.findViewById(R.id.ciudad);
                        tv.setText(addresses);
                        ((BaseAdapter)(getListAdapter())).notifyDataSetChanged();
                        return v;
                    }
                @Override
                    public void onClick(DialogInterface dialog, int which) {
                        // TODO Auto-generated method stub

                    }

                    }
</code></pre>

<p>}</p>
