I have a progressbar
in a webview
inside a fragment
. Inside the onViewCreated()
method I have:
ProgressBar progressBar = (ProgressBar) view.findViewById(R.id.progress_bar);
The progressbar
is defined as follows:
<ProgressBar
android:id="@+id/progress_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="?android:attr/progressBarStyleHorizontal"
/>
And to show the progress of loading the page I have the following code:
webView.setWebChromeClient(new WebChromeClient() {
@Override
public void onProgressChanged(WebView view, int progress) {
progressBar.setProgress(progress);
}
});
And I am loading the url: "http://www.techcrunch.com"
The problem is, while the page is loading the progressbar
isn't visible. So to debug this I tried to output the progress inside the onProgressChanged()
method. Where am I going wrong?
I have used this link and this link as a reference but no joy.