-1

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?

SysGen
  • 576
  • 6
  • 29
RB Saud
  • 1
  • 1

1 Answers1

-1

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 '

Community
  • 1
  • 1
ashu
  • 1,624
  • 4
  • 20
  • 40
  • for your solution you need to press back key ... my requirements are after displaying the remote page user should be redirected to landing page of app automatically... – RB Saud Jun 09 '13 at 19:18
  • Oh! Your question was too clear to be understood. First register a good question with sufficient detail and then hope for a good and right answer. :/ – ashu Jun 09 '13 at 19:44