I am making a button that when pressed it multiplies a number by two but i keep getting an error saying invalid assignment operator and the red is underling the * which should mean multiply in java right?
mult.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
----> counter *2;
display.setText("Your total is " + counter);
}
});
Presuming there’s no code before the counter * 2, it should either be counter = counter * 2; or counter *=2; You’re not actually setting anything just by saying * 2 😛
Hopefully counter is a global variable so that it’s actually saved outside of the method haha.