Hi friends. In this video I will show you
how to create a web browser app which shows loading… when the page is loading
and which shows the URL of the page when the page is completely loaded. For that
we have to insert a Linear. Then we have use a ScrollView and inside this we use a WebView. Now change the padding of the Scroll to 0 and
change its layout_width to match_parent. After that, in the Linear insert TextView. Change the width of this TextView to 300 and then change the text size to
18 or 16 and also change the background color to the color you want. I will
use yellow here. No Lime. Then go to linear1 and change the layout gravity
to center_horizontal and also gravity to center_horizontal. Also change its
background color to a darker color like dark lime. After that go to LOGIC
area and in onCreate, load a URL. Here I will load Google. Also add new event onBackPressed, and
WebView onPageStarted and WebView onPageFinished. onBackPressed we will use
if-else button, if-else block. And then if WebView canGoBack, we will use the
block WebView goBack. And if it cannot go back then it can exit the app. For that we
use FinishActivity. After that we go to WebView onPageStarted. On page started
we will show ‘loading…’. We will set text of textview1 to Loading. And onPageFinished, we will
set the text of the same textview to the URL of the page. For that we will get the
URL. That’s all. Now let’s check our app. See that initially it shows ‘Loading’ when
the page is loading, and when the page is completely loaded it shows the URL. Now
if we click on a link it will again show ‘Loading’, and when that page is completely
loaded it shows the URL of that page. It is not editable. That’s all in this
video. Thank you very much for watching.

Display ‘Loading..’ while the webpage is loading
Tagged on:                     

One thought on “Display ‘Loading..’ while the webpage is loading

  • August 12, 2017 at 11:59 am

    Nice On..


Leave a Reply

Your email address will not be published. Required fields are marked *