How to manage each item in a list activity when clicked.
ListActivity derives from the activity class. However, listactivity let us automatically display a list of items stored in an adapter in the view of the activity. This is simple and easy. The complication starts when you have a custom layout for each item on the list. Most of the times you want to have control of the widgets found on the custom layout that forms each item of the list. Well how do you that? It is easy but finding the answer for this question took time. ListActivity have a defined function that you have to override called onListItemClicked(….) this function is called everytime an item of the list is gets touched or clicked.. This function parameters gives us several objects, however the view object and position are the ones that matters the most. The view object is the custom view of the list item clicked. With this view you can gain access to each widget that forms the layout of each item in the list by calling the function findViewById(). Now you have control of that widget on that custom layout for the item clicked. The position is also useful, for example, you an store it in an array of numbers to record the amount of times that same item was clicked or to prevent repetitions if it has been clicked more than once.