0

I have come up with a private browser,but I want to know how to link it to my code below when the browser is being opened.

Main Class

b5.setOnClickListener(new OnClickListener(){   
    public void onClick(View v){
        Intent i =new Intent(FiltersActivity.this,MyBrowser.class); 
        i.setData(Uri.parse("http://www.google.com"));
        startActivity(i);
    }
});

Second Class

public class MyBrowser extends Activity {

    public void onCreate(Bundle SavedIntstanceState) {
        super.onCreate(SavedIntstanceState);
        setContentView(R.layout.browser);

        Uri uri = getIntent().getData(); // get Intent and the linked data
        WebView webview = (WebView) findViewById(R.id.webView_01); // get the
                                                                // webview
                                                                // item
        webview.setWebViewClient(new Callback()); // set the object to the view
                                                // to webview
        webview.loadUrl(uri.toString()); // load the url

    }

    private class Callback extends WebViewClient { // crate a virtual class
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) { // /load
                                                                        // the
                                                                        // necessary
            return (false);
        }
    }
}
Didier Ghys
  • 30,396
  • 9
  • 75
  • 81
Brianmuks
  • 49
  • 7

1 Answers1

0

You can check out this blog with complete example that shows progess of the webview in the Title Bar.

Also you can have a look in the Android Docs activity.setProgress(progress)

And finally but not the least StackOverflow Answer

Community
  • 1
  • 1
Lalit Poptani
  • 67,150
  • 23
  • 161
  • 242