Implementing back button in webview fragment

前端 未结 4 795
花落未央
花落未央 2021-01-25 23:13

I want to implement the back button to my app. I\'m using fragments that each show a different webview. Right now if I press the back button, it closes the app no matter where I

4条回答
  •  爱一瞬间的悲伤
    2021-01-25 23:31

    You can begin by overriding the back button press in your MainActivity

    @Override
    public void onBackPressed() {
        //super.onBackPressed()
        //handle the press here to switch fragments
    }
    

提交回复
热议问题