how to pass an arraylist from a class extending arryadapter to an activity
<p>I am creating a custom <code>listview</code> in which I have given a checkbox. I have created a custom adapter class extending the adapter. I am storing the values of those checked box in an array in the adapter class. The name of the arraylist is itemname  (you can see it in the bottom of the customadapter class). I want to send this arraylist into an activity(for the purpose of storing those values into database). Since I am extending the array adapter class, I cannot use <code>sharedpreferences</code>. Can solve this issue? My adapter class is as below.</p>

<pre><code>    public class CustomArrayAdapter extends ArrayAdapter&lt;Model&gt; {

        protected static final String MODE_PRIVATE = null;
        private final List&lt;Model&gt; list;
        private final Activity context;


        public CustomArrayAdapter(Activity context, List&lt;Model&gt; list) {
            super(context, R.layout.customlistlayout, list);
            this.context = context;
            this.list = list;
        }

        static class ViewHolder {
            protected TextView mText;
            protected CheckBox mCheckbox;

            public string getItemAtPosition(int i) {
                // TODO Auto-generated method stub
                return null;
            }
        }

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            View view = null;
            if (convertView == null) {

                final ArrayList&lt;String&gt; itemname = new ArrayList&lt;String&gt;();
                LayoutInflater inflator = context.getLayoutInflater();
                view = inflator.inflate(R.layout.customlistlayout, null);
                final ViewHolder viewHolder = new ViewHolder();
                viewHolder.mText = (TextView) view.findViewById(R.id.settings_label);
                viewHolder.mCheckbox = (CheckBox) view.findViewById(R.id.check);

                Activity activity = new SettingsActivity();
                viewHolder.mCheckbox.setOnCheckedChangeListener(activity);
                viewHolder.mCheckbox
                        .setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

                            @Override
                            public void onCheckedChanged(CompoundButton buttonView,
                                    boolean isChecked) {
                                Model element = (Model) viewHolder.mCheckbox
                                        .getTag();  

                                element.setSelected(buttonView.isChecked());
                                **itemname.add(element.getName());**





                            }
                        });
                for (String myValue : itemname) {
                    System.out.println(myValue);
                }
                view.setTag(viewHolder);
                viewHolder.mCheckbox.setTag(list.get(position));
            } else {
                view = convertView;
                ((ViewHolder) view.getTag()).mCheckbox.setTag(list.get(position));
            }
            ViewHolder holder = (ViewHolder) view.getTag();
            holder.mText.setText(list.get(position).getName());
            holder.mCheckbox.setChecked(list.get(position).isSelected());
            return view;
        }
    }
</code></pre>

<p>I am calling this adapter class as below from an activity</p>

<pre><code>ArrayAdapter&lt;Model&gt; settingsadapter = new CustomArrayAdapter(this, getModel()); setListAdapter(settingsadapter);
</code></pre>
