setOnItemClickListener not activating in ListView Android

29 Views Asked by At

There is no actions in setOnItemClickListener, what is wrong in listView? The View appearing, but not active. No errors, not pushing, not reaction on clicking. What should I create else or how to connect view with listView?

Fragment class

ListView listView;
CursorAdapter cursorAdapter;
View view = inflater.inflate(layout, container, false);
listView = (ListView) view.findViewById(list);
cursorAdapter = new CursorAdapter(R.layout.listitem, getActivity(), null, true);
listView.setOnItemClickListener((parent, view1, position, id) -> someActions(id));
listView.setOnItemLongClickListener((adapterView, view1, i, l) -> {
            ask(view1, i, l);
            return true;
        });

layout xml with list id

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="vertical"
              android:layout_width="match_parent"
              android:layout_height="match_parent">
    <ListView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/list"/>

</LinearLayout>

listitem xml with include list_item_c

<ru.rambler.libs.swipe_layout.SwipeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/swipe_layout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:left_swipe_enabled="true"
    app:right_swipe_enabled="true">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <include layout="@layout/list_item_c" />
    </LinearLayout>

    <!--RIGHT-->
    <include layout="@layout/undo_layout" />

    <include layout="@layout/mark_layout" />
</ru.rambler.libs.swipe_layout.SwipeLayout>

list_item_c the main menu items

<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_marginBottom="2dp"
    android:layout_marginTop="2dp"
>

    <TextView
        android:id="@+id/textFrom"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginEnd="22dp"
        android:layout_marginStart="4dp"
        android:singleLine="true"
        android:textSize="17sp"
        app:layout_constraintEnd_toEndOf="@+id/attachemt"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <ImageView
        android:id="@+id/flag"
        android:layout_width="10dp"
        android:layout_height="10dp"
        android:layout_below="@+id/textFrom"
        android:contentDescription="@string/flag"
        app:srcCompat="?attr/iconFlagForwarded"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintStart_toEndOf="@+id/selected"
        app:layout_constraintTop_toBottomOf="@+id/textFrom" />
</androidx.constraintlayout.widget.ConstraintLayout>
0

There are 0 best solutions below