Comparing two editTexts in android

前端 未结 6 1542
既然无缘
既然无缘 2020-12-22 05:01

I am learning android I tried following codeline but it\'s giving me error please give me suggestions, that how can I compare two edittext\'s text.



        
6条回答
  •  青春惊慌失措
    2020-12-22 05:35

    Please try this:

    if((edt1.getText().toString.equalsIgnoreCase("X")) && 
       (edt4.getText().toString.equalsIgnoreCase("X")) && 
       (edt7.getText().toString.equalsIgnoreCase("X")))
    

    If you have to compare strings then you need to call the equals or equalsIgnoreCase function of String.

提交回复
热议问题