I use “include” XML. I do not want to set each “activity” setOnItemClickListener.
My “include” XML food.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/foot"
android:layout_width="fill_parent"
android:layout_height="36dp"
android:layout_alignParentBottom="true"
android:background="#292929"
android:gravity="right|center_vertical"
android:padding="5dp" >
<ImageView
android:id="@+id/imageView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="15dp"
android:src="@drawable/categories" />
</LinearLayout>
and where I set him
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#595858"
android:gravity="top" >
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@+id/foot">
<include
android:layout_alignParentBottom="true"
layout="@layout/foot" />
</RelativeLayout>
every time the my activity uses “foot” I set on my image “setOnItemClickListener”
I want to set only once setOnItemClickListener
Thanks for the help
Make all your activities inherit from a base activity class that will set the listener if the imageview with the appropriate ID exists: