-2
Give me one mistake R
appears in red.
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//reference to xml widgets
final TextView FishText = (TextView) findViewById(R.id.FishText);
Button ChangeNameButton = (Button) findViewById(R.id.ChangeNameButton);
final String animais[] = new String[5];
animais[0]="Dog";
animais[1]="Cat";
animais[2]="Rat";
animais[3]="Horse";
animais[4]="Mouse";
//change the name of the animal
ChangeNameButton.setOnClickListener(
new Button.OnClickListener(){
public void onClick(View view) {
for(int contador = 0;contador<5;contador++) {
FishText.setText(animais[contador]);
}
}
}
}
None. You need to rebuild.
– itscorey