i have many views (textview) in linearlayout
i want each view id when i click on view
but i dont want to setonclicklistener with every view
anyidea for me ?
thanks
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/textViewd1"
android:layout_width="46dp"
android:layout_height="40dp"
android:background="#111111"
android:gravity="center"
android:text="SUN"
android:textAppearance="?android:attr/textAppearanceSmall" />
...
many textviews
...
</LinearLayout>
Add the attribute
android:onClickto each view. (You should also probably explicitly setandroid:clickable="true".) It might save typing to set up a style for all this, particularly if some of the other attributes are shared among the many TextViews. In your Activity, define a method: