Note that there are some explanatory texts on larger screens.

plurals
  1. POlistview onitemclick does not trigger
    primarykey
    data
    text
    <p>This is the custom layout i am using for my list</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="10dip" android:layout_marginRight="10dip" android:background="@drawable/rounded_corner_5" android:gravity="center_vertical" android:orientation="horizontal" android:paddingBottom="5dip" android:paddingLeft="10dip" android:paddingRight="10dip" android:paddingTop="5dip" &gt; &lt;ImageView android:id="@+id/pic" android:layout_width="48dip" android:layout_height="48dip" android:layout_marginRight="5dip" android:src="@drawable/icon" /&gt; &lt;LinearLayout android:id="@+id/vert" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" &gt; &lt;LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_vertical" android:orientation="horizontal" &gt; &lt;TextView android:id="@+id/name" android:layout_width="0dip" android:layout_height="wrap_content" android:layout_weight="2" android:ellipsize="middle" android:singleLine="true" android:text="Amit" android:textColor="#000000" /&gt; &lt;TextView android:id="@+id/time" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:singleLine="true" android:text="5 days" android:textColor="#333333" /&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_vertical" android:orientation="horizontal" &gt; &lt;TextView android:id="@+id/currency" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Large Text" android:textAppearance="?android:attr/textAppearanceMedium" android:textColor="#333333" android:textStyle="bold" /&gt; &lt;TextView android:id="@+id/amount" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Large Text" android:textAppearance="?android:attr/textAppearanceMedium" android:textColor="#333333" /&gt; &lt;ImageView android:id="@+id/direction" android:layout_width="8dip" android:layout_height="8dip" android:layout_marginLeft="5dip" android:src="@drawable/incoming" /&gt; &lt;/LinearLayout&gt; &lt;TextView android:id="@+id/service" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Medium Text" android:textColor="#333333" /&gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; </code></pre> <p>And this is the part of code in activity that I am using to handle triggers</p> <pre><code>list.setItemsCanFocus(false); list.setOnItemClickListener(new OnItemClickListener(){ public void onItemClick(AdapterView&lt;?&gt; v, View view, int position, long itemId){ Toast.makeText(Home.this, "You selected: " + String.valueOf(position), Toast.LENGTH_SHORT).show(); SparseBooleanArray sp = list.getCheckedItemPositions(); if(sp.get(position) == true) view.setSelected(false); else view.setSelected(true); } }); </code></pre> <p>But despite all that, i cant get the Toast to show. Where am i going wrong?</p> <p>The code for the list view is</p> <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" &gt; &lt;com.markupartist.android.widget.PullToRefreshListView android:id="@+id/list" android:layout_width="0dip" android:layout_height="wrap_content" android:layout_weight="1" android:divider="@android:color/transparent" android:dividerHeight="20.0dip" /&gt; &lt;/LinearLayout&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload