Есть ListView, в котором 2 элемента.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:text="TextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="@+id/name" android:layout_weight="1"/>
<CheckBox
android:text="CheckBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="@+id/check" android:layout_weight="1"/>
</LinearLayout>
Вот так я отображаю свой String массив в ListView.
ArrayAdapter<String> adapter = new ArrayAdapter<String>(getContext(), R.layout.markers_list, R.id.name, name_mark);
list.setAdapter(adapter);
Как обращаться к LV с 1 элементом, я знаю. Но как мне отдельно расчленить, что должно происходить при нажатии на TextView, а что при нажатии на ChekBox? Просто ступор.
UPD.
Отказался от Фрагмента и начал выводить ListView в Активити. Вывел. Написал метод в Активити
public void qwe(View v){
TextView tx = v.findViewById(R.id.name);
tx.setText("sdfg");
}
и повесил его на кнопку
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent"
android:layout_height="match_parent">
<CheckBox
android:text="CheckBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="@+id/check" android:layout_weight="1"
android:focusable="false"
android:focusableInTouchMode="false" android:onClick="qwe"/>
<TextView
android:text="TextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="@+id/name" android:layout_weight="1"/>
</LinearLayout>
Где ошибка?