title: How to get back on the Webview page on Backbutton click, if any url is opened in Webview?
body: <p>I am having one activty, in which Webview is available. If I click on any URL in the webview, that url opens, but when I click the back button, it doesn't comes on the previous Webview page, but goes on the activity which is before that webview page.</p>
  
  <p><strong>Scenerio:-</strong> I am having a Xyz Activity, on some element of Xyz activity click it goes to a Webview activity which shows the loaded url on webview. on webview if I click on any url link, it opens, but when I click the back button, it goes back on the Xyz Activity and not on the Webview Activity. I want to come back on the Webview Activity and not on the Xyz Activity.</p>
  
  <p>Can anyone Guide me for the same, as I am not able to find what should I use or implement for making it work as I need? 
  Any help will be appreciated. Thanks in Advance...</p>
  
  <p><strong>EDit:-</strong></p>
  
  <p>The code is as follows:-</p>
  
  <pre><code>public class StoryDetail extends SherlockActivity
  {
      WebView content;
  
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState)
  {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.story_detail);
  
      BaseStory story = BaseStory.createFromCursor(c); // BaseStory is a class containing Database values...
  
      // Get the fields
      content = (WebView) findViewById(R.id.content);
      content.getSettings().setPluginState(PluginState.ON_DEMAND);
      content.getSettings().setJavaScriptEnabled(true);
      content.getSettings().setAllowFileAccess(true);
      content.setWebChromeClient(new WebChromeClient());
      content.setWebViewClient(new WebViewClient());
  
      String html = 
          "&lt;html&gt;&lt;head&gt;" + 
              "&lt;/head&gt;" +
          "&lt;body&gt;" +
  
              "&lt;section id=\"content\"&gt;" +
                  story.getContent() + 
              "&lt;/section&gt;" +
          "&lt;/body&gt;&lt;/html&gt;"; //story.getContent() contains title, image, and url link supporting HTML Format itself. 
      //On clicking url link the webview open that page in Webview.
  
      content.loadDataWithBaseURL("http://somelink/", html, "text/html", "UTF-8", "");
  
  }
  
  @Override
  public boolean onKeyDown(int keyCode, KeyEvent event) {
      if(event.getAction() == KeyEvent.ACTION_DOWN){
          switch(keyCode)
          {
          case KeyEvent.KEYCODE_BACK:
              if(content.canGoBack()){
                  content.goBack();
              }else{
                  finish();
              }
              return true;
          }
  
      }
      return super.onKeyDown(keyCode, event);
  }
  </code></pre>
  
  <p>}</p>