Note that there are some explanatory texts on larger screens.

plurals
  1. PONot Getting OnItemClick Event of ListView
    text
    copied!<p>As said in title I am Not Getting OnItemClick Event of ListView</p> <p>My code :</p> <pre><code>ListView listView1 = (ListView) findViewById(R.id.listView1); listView1.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int arg2, long arg3) { Toast.makeText(SelectQuizActivity.this, "OnItemClick", Toast.LENGTH_LONG).show(); } }); SimpleAdapter adapter = new SimpleAdapter(this, listView, R.layout.list_layout, new String[]{"topic","by","score"}, new int[]{R.id.textViewTopic,R.id.textViewTopicCreator,R.id.textViewScore}); listView1.setAdapter(adapter); </code></pre> <p><strong>Layout XML:</strong></p> <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" tools:context=".SelectQuizActivity" &gt; &lt;TextView android:id="@+id/textView1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:background="@drawable/bg_dark_gradient_rev" android:gravity="center_horizontal" android:padding="20dp" android:text="@string/app_name" android:textAppearance="?android:attr/textAppearanceLarge" android:textColor="@color/white" android:textStyle="bold" android:typeface="sans" /&gt; &lt;ListView android:id="@+id/listView1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/textView1" android:choiceMode="singleChoice" android:clickable="true" android:divider="@drawable/bg_light_gradient" android:dividerHeight="1dp" android:focusable="true" android:focusableInTouchMode="true" android:listSelector="@drawable/list" &gt; &lt;/ListView&gt; &lt;/RelativeLayout&gt; </code></pre>
 

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