Home > Software engineering >  Cannot resolve method 'getText' in 'ImageView'
Cannot resolve method 'getText' in 'ImageView'

Time:03-01

I am making a WhatsApp clone app and while working with Android Studio, I am getting an error that says - "Cannot resolve method 'getText' in 'ImageView'" I am new to android studio and don't know how to fix. Any help would be appreciated.

binding.btnSignUp.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if(!binding.txtUsername.getText().toString().isEmpty())
        }

CodePudding user response:

It seems the element associated with txtUsername is actually an imageView defined in your layout xml file. Change it to TextView and your code should work fine

  • Related