I have a problem whith the result of this code.
private void listenbtnOK(){
        btnValider.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String cip1  =" hello ";
                String cip =findViewById(R.id.txtCip).toString();
 
                Log.d("couche presentation","*****************ok "+cip1);
                Log.d("couche presentation","*****************ok "+cip);
 
            }
        });
    }
Of course in the EditText txtCip I wrote "hello". In logCat I have :
- 06-22 13:58:12.559 ......D/couche*presentation: *****************ok hello
 - 06-22 13:58:12.569 ..... D/couche*presentation: *****************ok androidx.appcompat.widget.AppCompatEditText{41b34980 VFED..CL ........ 0,34-204,83 #7f0700bd app:id/txtCip}
 
I would like to catch "hello" in cip string.
it is getting the object of the edit text and cast it into AppCompatEditText then you can get the text String cip = ((AppCompatEditText) findViewById(R.id.txtCip)).getText().toString(); – sourabh karmakar Jun 25 '20 at 11:46