Add Data into Listview Runtime using Custom Adapter
<p><a href="https://i.stack.imgur.com/FsNFY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FsNFY.png" alt="enter image description here"></a></p>

<p><strong>PROBLEM :</strong> when i am click on add button then all data are clear and only one item is shows.... i want to Show Old items as well as new added item...</p>

<p>this is my code.....</p>

<p>MODEL class</p>

<pre><code>public class GroupModel {
    ArrayList&lt;String&gt; G_member=new ArrayList&lt;String&gt;();
    ArrayList&lt;String&gt; G_name = new ArrayList&lt;String&gt;();


    public ArrayList&lt;String&gt; getG_member() {
        return G_member;
    }

    public void setG_member(ArrayList&lt;String&gt; g_member) {
        G_member = g_member;
    }
    public void addToGmember(String gname){
        this.G_member.add(gname);
    }

    public ArrayList&lt;String&gt; getG_name() {
        return G_name;
    }

    public void setG_name(ArrayList&lt;String&gt; g_name) {
        G_name = g_name;
    }
    public void addToGname(String name){
        this.G_name.add(name);
    }
}
</code></pre>

<p>MAIN ACTIVITY</p>

<pre><code>public class MainActivity extends ActionBarActivity {

    Context context=this;
    private ListView lv;
    ImageView plus_img;// plus button to add GROUP Runtime.
    GroupModel model = new GroupModel();
    GroupAdapter adapter;
    ListView myListView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        lv = (ListView) findViewById(R.id.group__listview);
        myListView = lv;
        //plus image
        plus_img = (ImageView) findViewById(R.id.add_img);
        plus_img.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                model.addToGname("jignesh");
                model.addToGmember("8");
                ArrayList&lt;GroupModel&gt; l = new ArrayList&lt;GroupModel&gt;();
                l.add(model);
           //     adapter.setListData(getListData());
                myListView.setAdapter(new GroupAdapter(context, l));
            //    adapter.notifyDataSetChanged();
            }
        });


        adapter= new GroupAdapter(context,getListData());
        lv.setAdapter(adapter);

}

    private ArrayList getListData() {
        ArrayList list = new ArrayList();
        int untilloop;

        if(model.getG_member().size()&gt;10)
        {
            untilloop = model.getG_member().size();
            for (int i=0;i&lt;untilloop;i++)
            {
                model.getG_member();
                model.getG_name();
                list.add(model);
            }
        }
        else{
            untilloop=10;
            for(int i = 0; i &lt;untilloop; i++){
                model.getG_name().add("raj "+i );
                model.getG_member().add(""+i);
                list.add(model);
            }
        }

        return list;
    }
}
</code></pre>

<p>ADAPTER class</p>

<pre><code>public class GroupAdapter extends BaseAdapter {
    ArrayList&lt;GroupModel&gt; glist;
    Context context;
    private LayoutInflater layoutInflater;

    public GroupAdapter(Context mainActivity, ArrayList&lt;GroupModel&gt; glist) {
        context = mainActivity;
        this.glist=glist;
        layoutInflater = LayoutInflater.from(context);
    }
    public void setListData(ArrayList&lt;GroupModel&gt; data){
        glist = data;
    }

    @Override
    public int getCount() {
        return glist.size();
    }

    @Override
    public Object getItem(int position) {
        return glist.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder;
        if(convertView==null){
         //  LayoutInflater inflater = ((Activity) context).getLayoutInflater();
            convertView = layoutInflater.inflate(R.layout.row_list_data,null);
            holder= new ViewHolder();
            holder.g_number=(TextView)convertView.findViewById(R.id.txt_g_number);
            holder.g_name=(TextView)convertView.findViewById(R.id.txt_g_name);
            holder.nxt_aerrow=(ImageView)convertView.findViewById(R.id.img_nxt);
            convertView.setTag(holder);
        }else {
            holder = (ViewHolder) convertView.getTag();
        }
        holder.g_number.setText(glist.get(position).getG_member().get(position).toString());
        holder.g_name.setText(glist.get(position).getG_name().get(position).toString());

        holder.nxt_aerrow.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(context,"image click",Toast.LENGTH_SHORT).show();
            }
        });
        return convertView;
    }
    static class ViewHolder {
        TextView g_number,g_name;
        ImageView nxt_aerrow;
    }
}
</code></pre>