ParagonTime
ParagonTime

Reputation: 145

Error message while trying to set a background in android studio?

I am trying to change the background of an Image View within a gesture event but I'm getting the error - Expression Expected , or )

Here is the code that giving me the issue

@Override
public boolean onSingleTapConfirmed(MotionEvent e) {
    if (currentEvent == Event.single_tap) {
        mainMessage.setText("tap me twice");
        TopLeftArrow.setBackground(#000000);

        currentEvent = Event.double_tap;     //set to next desired event
        return true;
    }

    return false;
}

The error is showing up at the line

TopLeftArrow.setBackground(#000000);

Upvotes: 0

Views: 115

Answers (1)

Narendra Kothamire
Narendra Kothamire

Reputation: 973

You cant give background color like this

TopLeftArrow.setBackground(#000000);

Correct way is this

TopLeftArrow.setBackgroundColor(Color.parse("#000000"));

Upvotes: 1

Related Questions