java - Android Listview OnClickListener not working -


my problem when click list item in main layout time it's triggered not time. don't know how solve problem?. please me..

my code is:

view v = convertview.findviewbyid(r.id.chat_window_single); v.setonclicklistener(new view.onclicklistener() {     @override     public void onclick(view v) {         log.i("position",v.gettag().tostring());         sharedpreferences.editor editor = sharedpreferences.edit();         editor.putlong("eventid", groupeventmolist.get(integer.parseint(v.gettag().tostring())).geteventid());         editor.putstring("eventtitle",groupeventmolist.get(integer.parseint(v.gettag().tostring())).gettext());         editor.commit();         intent groupact = new intent(context, groupchatactivity.class);         startactivity(groupact);     }  }); 

my layout file :

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/chat_window_single" android:layout_width="match_parent" android:layout_height="wrap_content" android:clickable="false" android:focusable="false" android:focusableintouchmode="false" android:orientation="vertical" android:descendantfocusability="blocksdescendants">  <textview     android:id="@+id/chat_title"     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:layout_margin="5sp"     android:shadowdx="1"     android:shadowdy="1"     android:textcolor="@android:color/primary_text_light"     android:textsize="20sp" > </textview>  <textview     android:id="@+id/event_place"     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:layout_margin="5sp"     android:shadowdx="1"     android:shadowdy="1"     android:textcolor="@android:color/primary_text_light"     android:textsize="20sp" > </textview>  <textview     android:id="@+id/event_date"     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:layout_margin="5sp"     android:shadowdx="1"     android:shadowdy="1"     android:textcolor="@android:color/primary_text_light"     android:textsize="20sp" >  </textview>   </linearlayout> 

my main layout file :

<?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"   android:orientation="vertical" >  <listview     android:id="@+id/chat_list_view"     android:layout_width="fill_parent"     android:layout_height="wrap_content"     android:layout_marginbottom="80dp" >  </listview> </linearlayout> 

any appreciated.

your textviews stealing focus parent list view, make them clickable , focusable = false upermost linear layout needs android:descendantfocusability="blocksdescendants"


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -