-2

I have created two textview and one editText in my second Custom ListView, i want to set value name , rate,quant in my custom listView one by one which is already show on Toast,also I have first listView which have 5 Value which i have to show on Second Custom listView on Button onClick() Event..

    int count = lisView1.getAdapter().getCount();
    for(int i=0;i<count;i++)
    {
    LinearLayout itemLayout = (LinearLayout)lisView1.getChildAt(i); // Find by under       LinearLayout
    TextView itemname = (TextView)itemLayout.findViewById(R.id.nm);
    TextView rat = (TextView)itemLayout.findViewById(R.id.rat);
    EditText quan = (EditText)itemLayout.findViewById(R.id.txtInput);
    String     rate = rat.getText().toString();
    String  quant = quan.getText().toString();
    String     name = itemname.getText().toString();
    Toast.makeText(Mmnue.this,name + ", " + rate+ " , " +quant   ,Toast.LENGTH_LONG).show(); 


    }
The Heist
  • 1,444
  • 1
  • 16
  • 32
Ravi Kumawat
  • 27
  • 1
  • 7
  • Check : http://stackoverflow.com/questions/25375831/customarrayadapter-implementationunable-to-get-the-resource-id/25376257#25376257 – Haresh Chhelana Sep 10 '14 at 07:22

1 Answers1

2

You cannot use a for-loop for this.

You need to use getView(int position, View convertView, ViewGroup parent)

I suggest you read some tutorials on Custom Adapters in ListView.

This stackoverflow post puts it very simply. Easy to understand.

And this tutorial should go a long way in helping you to work with ListViews.

Community
  • 1
  • 1
Swayam
  • 16,294
  • 14
  • 64
  • 102