just like what phonegap does, we can simply override and handle the android backButton using javascript but in this case i don't use phonegap. is there a way to handle that without phonegap?
Asked
Active
Viewed 976 times
1 Answers
-1
You can call javascript inside your onBackPressed()
method:
@Override
public void onBackPressed(){
WebView.loadUrl("javascript: var result = window.YourJSLibrary.callSomeFunction();
window.JavaCallback.returnResult(result)");
}
for detailed answer check this solution: How to call javascript from Android?
-
i already have a webview which loads the local html page from asset folder so i can't achieve that :( any other solution? – Rosdiana Mar 13 '15 at 08:53