I know how to populate listview and I know how to make custom adapter. I want to add View inside Linear layout of rowLayout of ListView. Here is MyList Adapter.
I want a listview which each item layout is created runtime But I can not achieve this.
This code is working without ListView but when I add it to Linearlayout inside listview .It Gives me error.
public class KmapListAdapter extends BaseAdapter  {
    Context context;
    LayoutInflater layoutInflater;
    List<KmapModel> mOriginalValues = new ArrayList<KmapModel>();
    public KmapListAdapter(Context activity, List<KmapModel> kmapModelList) {
        this.context = activity;
        this.mOriginalValues = kmapModelList;
    }
    @Override
    public int getCount() {
if(mOriginalValues == null)
    return  0;
        return mOriginalValues.size();
    }
    @Override
    public Object getItem(int position) {
        return mOriginalValues.get(position);
    }
    @Override
    public long getItemId(int position) {
        return position;
    }
    ViewHolder Holder ;
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        KmapModel kmapModel;
        if (layoutInflater == null)
            layoutInflater = (LayoutInflater) context
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        if (convertView == null) {
            Holder = new ViewHolder();
            convertView = layoutInflater.inflate(R.layout.rowlayout, null);
            Holder.linearLayout = (LinearLayout) convertView.findViewById(R.id.linear_layout_matrix_1);
            convertView.setTag(Holder);
        } else
            Holder = (ViewHolder) convertView.getTag();
        kmapModel = mOriginalValues.get(position);
        Holder.linearLayout.addView(kmapModel.getLinearLayout());
        return convertView;
    }
    static class ViewHolder {
        LinearLayout linearLayout;}}
And it is my Model List
 public List<KmapModel> ListViewOneItem( int ROWS, int COLS) {
        String[][] KmapArray = KMapMaker(ROWS, COLS);
        //  Log.v("Kmap array",""+KmapArray);
        TextView[][] KmapTextView = new TextView[KmapArray.length][KmapArray[0].length];
        int temp = 3;
        for (int i = 0; i < KmapArray.length; i++) {
            KmapModel kmapModel = new KmapModel();
            LinearLayout rowLinearLayout = makeRowLinearLayout();
            for (int j = 0; j < KmapArray[0].length; j++) {
                TextView rowTextView = makeTextView();
                rowTextView.setPadding(4, 4, 4, 4);
                rowLinearLayout.addView(rowTextView);
                KmapTextView[i][j] = rowTextView;// Add a text view in a jagged array for later use
            }
            kmapModel.setLinearLayout(rowLinearLayout);
            kmapModelList.add(kmapModel);
        }
        return  kmapModelList;
    }
Now I got an Error
The specified child already has a parent. You must call removeView() on the child's parent first. on this line
 Holder.linearLayout.addView(kmapModel.getLinearLayout());
Q1) How to resolve this Problem Q2) Why I am getting this issue?
Thanks @pskink he give me a way I try Then I upload Solution.