buttonPressed must be volatile