Open URL in WebView:
In android open website by using WebView. WebView use for display website content in android like as browser.
What is WebView:
WebView use for open website in android like browser. WebView display all website data in andriod.
Like this URL open in WebView http://invokecode.blogspot.in/
Like this URL open in WebView http://invokecode.blogspot.in/
![]() |
WebView in Android |
Open URL in WebView:
simple open url in websview
webview.loadUrl("url");
but when click on any link in this page then it open in browser and not open in this webview so we use WebViewClient for open in same webview like website
Why URL Open in Default Browser:
as we discuss url open in default browser not open in websview like website as show in pic.
![]() |
URL Open in Default Browser |
Open Link in Same WebView:
open URL in same webview then use WebViewClient. by extend and it has @Override Mothod basically Three Metho called
onPageStarted
shouldOverrideUrlLoading(load URL)
onPageFinished(Load URL Complete and it finish)
webView.setWebViewClient(new webViewClient());
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl("http://invokecode.blogspot.in/");
public class webViewClient extends WebViewClient
{
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
// TODO Auto-generated method stub
super.onPageStarted(view, url, favicon);
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
// TODO Auto-generated method stub
view.loadUrl(url);
return true;
}
@Override
public void onPageFinished(WebView view, String url) {
// TODO Auto-generated method stub
super.onPageFinished(view, url);
// if use Progress Dialog then Dismiss Here
}
}
above code for view complete website in WebView, now when load website and show Doload or some Progress Bar that use wait and load website then it hide lke that:
Note: if any issue to implement this code or need help related this tutorial Please comments I will revert back.
For More Turorials Visit: http://invokecode.com/
Like Us On Facebook: InvokeCode
Thank You !!
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
// TODO Auto-generated method stub
super.onPageStarted(view, url, favicon);
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
// TODO Auto-generated method stub
view.loadUrl(url);
return true;
}
@Override
public void onPageFinished(WebView view, String url) {
// TODO Auto-generated method stub
super.onPageFinished(view, url);
// if use Progress Dialog then Dismiss Here
}
}
above code for view complete website in WebView, now when load website and show Doload or some Progress Bar that use wait and load website then it hide lke that:
Show Dialog in WebView:
show dialog in webview onPageStarted Method show dialog and dismiss in onPageFinished:
![]() |
Show Dialog in WebView |
For More Turorials Visit: http://invokecode.com/
Like Us On Facebook: InvokeCode
Thank You !!
wow thats a great tutorial for newbie's
ReplyDeleteThank You Manisha
ReplyDeleteNice to see step by step process to load URL in WebView in android app. Being an active member of many android developer forum, I am looking to learn such tips. It really rocks.
ReplyDeleteThanks
DeleteIt is really a great work and the way in which u r sharing the knowledge is excellent.
ReplyDeleteIt is really nice information is very relevant and the way of sharing the knowledge is excellent.
ReplyDeleteGreat content thanks for sharing this informative blog which provided me technical information keep posting.
ReplyDeleteBlueprism training in Chennai
Blueprism training in Bangalore
Blueprism training in Pune
Blueprism training in tambaram
Blueprism training in annanagar
Blueprism training in velachery
Blueprism training in marathahalli
Wow it is really wonderful and awesome thus it is very much useful for me to understand many concepts and helped me a lot. it is really explainable very well and i got more information from your blog.
ReplyDeleterpa training in Chennai | rpa training in pune
rpa online training | rpa training in bangalore
I know you feel more happy when you get things done and best of all those things are your most precious treasure.
ReplyDeletepython training in tambaram
python training in annanagar
python training in OMR
python training in chennai
Well researched article and I appreciate this. The blog is subscribed and will see new topics soon.
ReplyDeletejava online training | java training in pune
java training in chennai | java training in bangalore
I am really impressed with your efforts and really pleased to visit this post.
ReplyDeleteangularjs Training in bangalore
angularjs Training in bangalore
angularjs Training in btm
angularjs Training in electronic-city
angularjs online Training
Whoa! I’m enjoying the template/theme of this website. It’s simple, yet effective. A lot of times it’s very hard to get that “perfect balance” between superb usability and visual appeal. I must say you’ve done a very good job with this.
ReplyDeleteOracle Training in Chennai | Best Oracle Training Institute in Chennai
Web Design Training in Chennai
Web Design Training in Chennai|Best Web Design Training in Chennai
AngularJS Training in Chennai |Advanced SAS Training in Chennai | Best SAS Training in Chennai
It is really an good information.
ReplyDeleteAngularJS training in chennai | AngularJS training in anna nagar | AngularJS training in omr | AngularJS training in porur | AngularJS training in tambaram | AngularJS training in velachery
great information for who want to start career in digital marketing field. But also try to add thansk
ReplyDeleteAi & Artificial Intelligence Course in Chennai
PHP Training in Chennai
Ethical Hacking Course in Chennai Blue Prism Training in Chennai
UiPath Training in Chennai
Awesome post with lots of data and I have bookmarked this page for my reference. Share more ideas frequently.keep it up!!!
ReplyDeleteAndroid Training in Chennai
Android Online Training in Chennai
Android Training in Bangalore
Android Training in Hyderabad
Android Training in Coimbatore
Android Training
Android Online Training