android - TextWatcher not working, what is wrong -


the implementation of textwatcher in oncreate method not working, tried doing text typing using virtual keyboard , hardware keyboard present, tried code on emulator , real device. nothing seems work.

i renamed edittexts in layout , clean project, re-build it, no hope

any idea?

here code

@override protected void oncreate(bundle savedinstancestate) {     // todo auto-generated method stub     super.oncreate(savedinstancestate);     setcontentview(r.layout.remarks);     getwindow().addflags(windowmanager.layoutparams.flag_keep_screen_on);     getwindow().addflags(windowmanager.layoutparams.flag_fullscreen);     intent = getintent();     current_language = i.getstringextra("lang");     q1rate = i.getfloatextra("q1rate", 0f);     q2rate = i.getfloatextra("q2rate", 0f);     q3rate = i.getfloatextra("q3rate", 0f);     q4rate = i.getfloatextra("q4rate", 0f);     q5rate = i.getfloatextra("q5rate", 0f);     loadsettings();     nextbtnstate();     final edittext edt_phoneno     = (edittext) findviewbyid(r.id.edt_remarks_phoneno);     final edittext edt_suggestions = (edittext) findviewbyid(r.id.edt_remarks_suggestion);     edt_suggestions.addtextchangedlistener(new textwatcher() {         public void ontextchanged(charsequence s, int start, int before, int count) {         }         public void beforetextchanged(charsequence s, int start, int count, int after) {         }         public void aftertextchanged(editable s) {             showtoast("i here firas");             resettimeout();         }     });     edt_phoneno.addtextchangedlistener(new textwatcher() {         public void ontextchanged(charsequence s, int start, int before, int count) {         }         public void beforetextchanged(charsequence s, int start, int count, int after) {         }         public void aftertextchanged(editable s) {             showtoast("i here firas");             resettimeout();         }     }); } 

here showtoast

public void showtoast (string msg) {     context context = getapplicationcontext();     charsequence text = msg;     int duration = toast.length_long;     toast toast = toast.maketext(context, text, duration);     toast.setgravity(gravity.center|gravity.center, 0, 0);     toast.show(); } 

and here layout

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/linearlayout1" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/azure1" android:focusable="true" android:focusableintouchmode="true" android:gravity="center_vertical" android:orientation="vertical" >  <gridlayout     android:id="@+id/grid1"     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:layout_gravity="top"     android:columncount="4"     android:rowcount="4" >      <space         android:layout_width="wrap_content"         android:layout_height="wrap_content" />      <imageview         android:id="@+id/img_clientlogo"         android:layout_width="275dp"         android:layout_height="145dp"         android:layout_gravity="left"         android:src="@drawable/general_client_logo" />      <textview         android:id="@+id/tv_customersatisfactionsurvey"         android:layout_width="948dp"         android:layout_height="103dp"         android:layout_column="3"         android:layout_gravity="center"         android:layout_margin="10dp"         android:layout_row="0"         android:gravity="center"         android:text="@string/customer_satisfaction_survey"         android:textappearance="?android:attr/textappearancelarge"         android:textcolor="@color/orangered2"         android:textsize="50sp" /> </gridlayout>  <relativelayout     android:id="@+id/ly_stars"     android:layout_width="match_parent"     android:layout_height="379dp">      <edittext         android:id="@+id/edt_remarks_phoneno"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_below="@+id/tv_remarks_phoneno"         android:layout_centerhorizontal="true"         android:layout_margintop="15dp"         android:ems="10"         android:hint="@string/mobile_no"         android:inputtype="phone" >          <requestfocus />     </edittext>      <textview         android:id="@+id/tv_remarks_suggestions"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_below="@+id/edt_remarks_phoneno"         android:layout_centerhorizontal="true"         android:layout_margintop="25dp"         android:text="@string/any_comment"         android:textsize="25sp"         android:textstyle="bold" />      <edittext         android:id="@+id/edt_remarks_suggestion"         android:layout_width="590dp"         android:layout_height="wrap_content"         android:layout_below="@+id/tv_remarks_suggestions"         android:layout_centerhorizontal="true"         android:layout_margintop="15dp"         android:ems="10"         android:hint="@string/suggestion"         android:inputtype="textcapsentences|textmultiline"         android:singleline="false" />      <textview         android:id="@+id/tv_remarks_phoneno"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_alignparenttop="true"         android:layout_centerhorizontal="true"         android:layout_margintop="50dp"         android:gravity="center"         android:text="@string/phone_account_no"         android:textsize="25sp"         android:textstyle="bold" />  </relativelayout>  <relativelayout     android:id="@+id/ly_nextprevios"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:gravity="bottom" >      <button         android:id="@+id/btn_next"         style="@style/buttontext"         android:layout_width="250dp"         android:layout_height="100dp"         android:layout_above="@+id/tv_poweredby"         android:layout_alignparentright="true"         android:layout_marginbottom="10dp"         android:layout_marginright="45dp"         android:background="@drawable/btn_blue"         android:drawableright="@drawable/arrow_right"         android:onclick="next_page"         android:text="@string/btn_next" />      <textview         android:id="@+id/tv_poweredby"         android:layout_width="772dp"         android:layout_height="wrap_content"         android:layout_alignparentbottom="true"         android:layout_centerhorizontal="true"         android:gravity="center"         android:text="@string/powerd_by_prime"         android:textappearance="?android:attr/textappearancemedium"         android:textsize="16sp" />      <button         android:id="@+id/btn_previous"         style="@style/buttontext"         android:layout_width="250dp"         android:layout_height="100dp"         android:layout_above="@+id/tv_poweredby"         android:layout_alignparentleft="true"         android:layout_marginbottom="10dp"         android:layout_marginleft="45dp"         android:background="@drawable/btn_blue"         android:drawableleft="@drawable/arrow_left"         android:onclick="previous_page"         android:text="@string/btn_previous" />      <imageview         android:id="@+id/img_help"         android:layout_width="48dp"         android:layout_height="48dp"         android:layout_alignbottom="@+id/btn_previous"         android:layout_centerhorizontal="true"         android:onclick="showhelpdialog"         android:src="@drawable/help_64" />      <textview         android:id="@+id/tv_steps"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_above="@+id/progressbar1"         android:layout_centerhorizontal="true"         android:layout_marginbottom="10dp"         android:text="@string/step6of6"         android:textappearance="?android:attr/textappearancemedium" />      <progressbar         android:id="@+id/progressbar1"         style="?android:attr/progressbarstylehorizontal"         android:layout_width="650dp"         android:layout_height="20dp"         android:layout_above="@+id/img_help"         android:layout_centerhorizontal="true"         android:layout_marginbottom="10dp"         android:max="6"         android:progress="6"         android:progressdrawable="@drawable/my_progress" />  </relativelayout>  </linearlayout> 

the naming of edittext conflicting layout renamed edittexts in both layouts , cleaned project works google must conflict of naming of vies on different layouts


Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -