added functionality to detect back button on Android