android - Get access to particular item's layout in list view -


in android app main activity extends list activity. store there elements called items, layout defined itemlayout xml file , use custom adapter (called itemadapter) transfer data list view in main activity. in itemlayout there's imageview , aim change image when user clicks on particular item in list view. in opinion easiest way achieve access particular item's (the 1 clicked) layout, there find imageview , call method setimagebitmap. how can "find" layout of clicked item? tried many things in method:

@override protected void onlistitemclick(listview l, view v, int position, long id) {     super.onlistitemclick(l, v, position, id);  } 

but nothing worked. have add itemadapter? or possible in onlistitemclick(…) can't find out how?

you're thinking in wrong way. adapter's way map data views. if want change how particular view looks given position, need change it's correlating data rendered view changes. attempting modify view directly kinda goes against how adapters meant used.

so in case, when user clicks on item. find item in adapter via position number. update item , ensure notifydataset called. meanwhile, adapter's getview() handle displaying appropriate image.


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -