1

enter image description here

I am getting two problems in list view

when i input value on edit text and scroll list view then edit text is automatically empty.

I am not able to get All listview row information on save draft button click when edit Text is not empty, non empty edit text may be one or more than one.

here my list view adapter code

class CreateAdapter extends ArrayAdapter<String> {  
    TextView txtItecode, txtItem;
    EditText editQuantity;
    String[] strItecode;
    String[] strItem;
    String[] strQuantity;
    Context context;

    CreateAdapter(Context context, String[] strItemcode, String[] strItem,
            String[] strQauntity) {
        super(context, R.layout.create_list_item, R.id.txtItemcode, strItemcode);
        this.context = context;
        this.strItecode = strItemcode;
        this.strItem = strItem;
        this.strQuantity = strQauntity;
    }

    public View getView(int position, View convertView, ViewGroup parent) {
        LayoutInflater mInflater = (LayoutInflater) context
                .getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
        View row = mInflater.inflate(R.layout.create_list_item, parent, false);

        txtItecode = (TextView) row.findViewById(R.id.txtItemcode);
        txtItem = (TextView) row.findViewById(R.id.txtItem);
        editQuantity = (EditText) row.findViewById(R.id.editcreateQuantity);

        txtItecode.setText(strItecode[position]);
        txtItem.setText(strItem[position]);
        editQuantity.setText(strQuantity[position]);

        return row;
    }
}

I am new In Android Development Please Help Me how i can fix this problem.

I am working on it past two days

isaias-b
  • 2,255
  • 2
  • 25
  • 38
Kuldeep
  • 367
  • 2
  • 7
  • 19

1 Answers1

0

try this,

class CreateAdapter extends ArrayAdapter<String> {
    String[] strItecode;
    String[] strItem;
    String[] strQuantity;
    Context context;

    CreateAdapter(Context context, String[] strItemcode, String[] strItem,
            String[] strQauntity) {
        super(context, R.layout.create_list_item, R.id.txtItemcode, strItemcode);
        this.context = context;
        this.strItecode = strItemcode;
        this.strItem = strItem;
        this.strQuantity = strQauntity;
    }

    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder = null;
        LayoutInflater mInflater = (LayoutInflater) context
                .getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
        if (convertView == null) {

            holder = new ViewHolder();
            convertView = mInflater
                    .inflate(R.layout.create_list_item, parent, false);

            holder.txtItecode = (TextView) convertView
                    .findViewById(R.id.txtItemcode);
            holder.txtItem = (TextView) convertView
                    .findViewById(R.id.txtItem);
            holder.editQuantity = (EditText) convertView
                    .findViewById(R.id.editcreateQuantity);

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

        holder.txtItecode.setText(strItecode[position]);
        holder.txtItem.setText(strItem[position]);
        holder.editQuantity.setText(strQuantity[position]);

        return convertView;
    }

    class ViewHolder {
        TextView txtItecode;
        TextView txtItem;
        EditText editQuantity;
    }
}
isaias-b
  • 2,255
  • 2
  • 25
  • 38
Akash Moradiya
  • 3,318
  • 1
  • 14
  • 19