cycle if in textview in android studio

1

I am new to programming and would like to know how to do if in android studio a textview says Dog I get the image of a dog and if in that same% textview says cat the image appears of a cat.

Thank you in advance for the help.

    
asked by Jorsh González 04.12.2017 в 02:35
source

1 answer

-1
String text = textview.getText().toString();
if(text.equals("gato")){
    //posiblemente: imageView.setImageResource(R.drawable.gato);
}else if(text.equals("perro")){
    //posiblemente: imageView.setImageResource(R.drawable.perro);
}else{
    //codigo
}
    
answered by 04.12.2017 / 02:45
source