[Solved] How to get the id resource id of a view in a List view


For your ListView, you can set an onItemClickListener as below

ListView listView1 = (ListView) findViewById(R.id.listView1);
listView1.setOnItemClickListener(new OnItemClickListener() {
    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
        //With the position parameter, you can fetch the item at the clicked position like below. 
        AnimalsListItems yourItem = (AnimalsListItems) listView1.getItemAtPosition(position);
        //Now you can assign the image to an imageview 
    }
}

4

solved How to get the id resource id of a view in a List view