mercredi 22 novembre 2017

warning - 'if' statement has empty body

i am stuck and tried different things but still i don't know what I am doing wrong in the code to get the empty body error.

public void eatCookie(View view) {

    Button button = (Button) findViewById(R.id.button_Option);
    final String buttonText = button.getText().toString();
    String eatCookie = "EAT COOKIE";
    if (buttonText == eatCookie);{
        // TODO: Find a reference to the ImageView in the layout. Change the image.
        ImageView imageView = (ImageView) findViewById(R.id.android_cookie_image_view);
        imageView.setImageResource(R.drawable.after_cookie);


        // TODO: Find a reference to the TextView in the layout. Change the text.
        TextView textView = (TextView) findViewById(R.id.status_text_view);
        textView.setText("I'm so full");

        button.setText("Reset");
    }

Aucun commentaire:

Enregistrer un commentaire