Check and clear last value I have a method like this:  

public boolean wasUserInactive() {
    boolean result = userInactive;
    userInactive = false;
    return result;
}  


This works, but is there a “smarter” way to code this?
This method satisfies two concerns:


mark users as active
return the last status of inactivity


This should be two separate methods so as to not violate SRP and enable checking of that status without resetting it.

wasUserInactive should be isUserInactive and just return userInactive;. Additionally there should be a method resetting the inactive status to false.

Don't introduce quantum behaviour in your code, where observing a state changes it!