Use Android hardware back button to go back to previous slide in a slidebox



I have a slidebox in my app.


What is the best practice to make the Android hardware back button go back to the previous slide ?
Without disturbing the general behavior of the back button in the reste of the app…



I didn’t put it to the test, but have you tried this ?:



}, 100);

put it in the controller


Great it works, but now, what if I need the back button to have its normal behavior if I am on the first slide ?



I tried the solution from @bengtler here : registerBackButtonAction working on many views

but it doesn’t seem to de-register the function…


try this solution: Closing modal With Android back button