У меня есть ListView, который первоначально перечислял элементы из пункта меню с одним TextView.Код, который я использовал для получения выбранного элемента:
menuList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View itemClicked, int position, long id)
{
TextView textView = (TextView) itemClicked;
String strText = textView.getText().toString();
});
Теперь я добавил еще один TextView, так что у меня есть два значения для каждого элемента, один под другим, и мой menu_item.xml выглядит так
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:padding="10sp">
<TextView
android:id="@+id/rowid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/exhibitor_header" />
<TextView
android:id="@+id/rowidtwo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/listview_background"
android:layout_below="@+id/rowid"/>
</RelativeLayout>
Как я могу получить значение для rowid, когда элемент выбран?