Clicking back button inside webview closes the app

Hi,

when I click on back button when I am inside the webview, the app terminates instead of going to home page.

I tried - webview->requestFocus(); but still the app gets closed.

Other solution mentioned here is this code -

if (this.getCurrentFocus() != Cocos2dxGLSurfaceView.getInstance())
{ Cocos2dxGLSurfaceView.getInstance().requestFocus(); }

The above code is too old.

how to solve this issue in newer cocos2dx version

It’s an Android issue, because you as the developer has to implement it. See for example https://stackoverflow.com/questions/6077141/how-to-go-back-to-previous-page-if-back-button-is-pressed-in-webview. I would suggest, that you file an issue in the issue tracker for that.

It works proper in most webpages but only when a paypal page is open in webview, and I tap back button it closes the app, otherwise it hides the webview and shows app homepage as I want.

So i think the problem is of focus, as paypal page must be changing the focus as mentioned in the above link.

Am I right? and if so how to use the above code in newer cocos version any idea?