I have an idea to set android:onClick="myClickMethod"
for several TextView's.
<TextView
android:id="@+id/search_suggestion_1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:onClick="myClickMethod"
android:clickable="true"/>
<TextView
android:id="@+id/search_suggestion_2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:onClick="myClickMethod"
android:clickable="true"/>
<TextView
android:id="@+id/search_suggestion_3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:onClick="myClickMethod"
android:clickable="true"/>
How can i differ from which TextView myClickMethod() is called?
you can do it by using the id's of each text-view. Use Switch-Case inside your myClickMethod based on text-view Id's. Also you can differentiate text-views by tag's.