androidwebviewviewflipper

how to display current webview in android


I have 3 webviews displaying query result for a search string from 3 search engines.. if google is displayed, i have yahoo and ask buttons at the bottom....when I click either of them, I get results for the entered query...

                    if(btn2.getText()=="Yahoo")
        {
            wv2.loadUrl("http://search.yahoo.com/bin/search?p="+value);
            vf.setDisplayedChild(1);
            System.out.println("Yahoo is working");
            btn1.setText("Ask");
            btn2.setText("Google");
        }

        else if(btn2.getText()=="Ask")
        {
            wv3.loadUrl("http://www.ask.com/web?q="+value);
            vf.setDisplayedChild(2);
            System.out.println("Ask is working");
            btn1.setText("Google");
            btn2.setText("Yahoo");
        }
        else if(btn2.getText()=="Google")
        {   
            wv1.loadUrl("http://www.google.com/search?q="+value);
            vf.setDisplayedChild(0);
            System.out.println("Google is working");
            btn1.setText("Yahoo");
            btn2.setText("Ask");
        }   

With the above code, each time i press the buttons at the bottom, I am getting query results regenerated,,,,I want to display the result if i select any.... For ex: Google results displayed the search string "FACEBOOK" and i selected first result in that....Suppose I select Yahoo button at the bottom, then yahoo is displayed and I have a google button formed at the bottom....when I click that google button, I want the first result that I selected previously...Kindly suggest what changes to make in the above code


Solution

  • Use this method:

    webview.getURL() on each button click.and get url that in string and just load that in that url in webview.

    I would just mention here take relevant webview for that method means as for Yahoo may you take webview1 like this.