Webview with asynctask on Android
Don't use AsyncTask, as you are not in charge of loading the webview. If you want to show a progress dialog, here is how to do it.
private ProgressDialog dialog = new ProgressDialog(WebActivity.this);
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.webview);
webView = (WebView) findViewById(R.id.webView1);
Bundle extras = getIntent().getExtras();
String url=extras.getString("adres");
webView.setWebViewClient(new WebViewClient() {
@Override
public void onPageFinished(WebView view, String url) {
if (dialog.isShowing()) {
dialog.dismiss();
}
}
});
dialog.setMessage("Loading..Please wait.");
dialog.setCanceledOnTouchOutside(false);
dialog.show();
webView.loadUrl(url);
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
}
The idea is that you show the dialog, you start loading the url, and when the webclient sees that the page has finished loading, it dismisses the dialog.
how to update webview from AsyncTask
I think the only solution is to load your data with an http request in doInBackground then use
loadData in publishProgress.
Multiple AsyncTasks load the same WebView
Remove the private String result;
line from the Async Task class.
Related Topics
Input Has Different Style on Focus
Firebase Endat() Not Working with Date String
Android How to Identify Item in Listview with Checkbox
Android: Velocity-Based Viewpager Scrolling
Android Browser Ignores Responsive Web Design
Trying to Fix Networkonmainthreadexception But Gives Toast Error
Searchview in Centre and After Focus It Goes to App Bar in Android
How to Implement Search in Customlistview Based on Class Item of Pojo Class in Android
Using Katzer Local Notification in Ibm Worklight
Firebase Changing Layout of Child Data Information in Android
CSS Overflow and Absolute Positioning Issue on Android Browser
How to Develop Android App Completely Using Python
Eclipse Hangs at The Android Sdk Content Loader
How Many Activities Vs Fragments
Scaling a Phonegap App for Different Android Screen Sizes/Densities