I have a ListView with 3 items and an OnItemClickListener.
How can I get a View of the second item?
I need to change the text in the second item when I click on the first item.
listView.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
// TODO Auto-generated method stub
switch (arg2) {
case 0:
((TextView)/*here i need a view of second item*/).setText();
});
One way would be ,
You can use view.getParent(), in your case arg1.getParent() and then use getChild() which will return an array of child views and use it accordingly.
you can use arg0.getChildAt(position) , this is better than previous solution, if it works for you.