I have a file XML with the name list_item.xml that contains the following code:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_weight="2"
android:orientation="horizontal">
<ImageView
android:layout_width="40dp"
android:layout_height="50dp"
android:id="@+id/telephone"
android:src="@drawable/telephone"/>
<ImageView
android:layout_width="40dp"
android:layout_height="50dp"
android:layout_marginLeft="5dp"
android:id="@+id/favorie"
android:src="@drawable/heart"/>
<ImageView
android:layout_width="40dp"
android:layout_height="50dp"
android:layout_marginLeft="10dp"
android:id="@+id/consulter"
android:src="@drawable/consulter"/>
</LinearLayout>
In java code I have the activity :
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.resultat_recherche);
The code of xml file(resultat_recherche.xml ):
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
I have filled this list with an Adapter :
ListAdapter adapter = new SimpleAdapter(
Resultat_recherche.this, contactList,
R.layout.list_item, new String[] { TAG_NAME}, new int[] { R.id.name});
setListAdapter(adapter);
Now I want to recover the éléments from list_item (ImageView) to manage the click and start intent.
i want for exemple when i click in imageview(telephone) i will do something
how I can do that in this activity ? Thank you