I am developing a web app in Android.
My situation: There are few html files to load on web view one file needs to go to remote server and load web page. Now I need to come to my landing page on Android asset folder.
Is there any way to handle it?
I am developing a web app in Android.
My situation: There are few html files to load on web view one file needs to go to remote server and load web page. Now I need to come to my landing page on Android asset folder.
Is there any way to handle it?
Add this in your Activity code (not in onCreate() or nested anywhere else)
@Override
public void onBackPressed() {
if (web.copyBackForwardList().getCurrentIndex() > 0) {
web.goBack();
}
else {
// Your exit alert code, or alternatively line below to finish
super.onBackPressed(); // finishes activity
}
}
This will navigate back through the WebView history stack until it is empty and then perform the default action (in this case it finishes the activity).
Or for more details see ' Back Navigation in a Webview Android App '