I have the following code. I'm using 4 fragment on an activity. The fragment has a webView. But as you know, preparing all the data for fragment takes long time. So I wanted to use a progress dialog while the data preparing. Yeah, I called it and now, just trying to dismiss the progressDialog after the progress is done. But I think it like me a lot. Not going anywhere. Any help?? Thanks.
(Note: I have erased the code from my project. Now added back in here so it's possible that I've made some little mistakes. Don't stuck in that.)
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
final ProgressDialog pd = new ProgressDialog(getActivity()) ;
if (wv != null) {
wv.destroy();
}
wv = new WebView(getActivity());
wv.getSettings().setJavaScriptEnabled(true);
wv.setWebChromeClient(new WebChromeClient() {
public void onProgressChanged(WebView view, int progress)
{pd = ProgressDialog.show(this, "", "Loading...", true);
Log.e("Progress:", ""+progress);
if(progress == 100){pd.dismiss();}
}
});
wv.setWebViewClient(new WebViewClient(){
@Override
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl)
{
Log.e("Connection:", "NO");
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url)
{
view.loadUrl(url);
return true;
}
});
wv.loadUrl("http://mobile.twitter.com/Yali_Spor");
wva = true;
return wv;
}