Update setProgress during AJAX requests
I have a WebView in my progress which updates without issue during page requests, but I would like to have onProgressCh开发者_如何学Goanged work during AJAX requests. Is this possible?
public void onProgressChanged(WebView view, int progress) {
activity.setProgress(progress * 100);
// Done?
if ( progress == 100 )
{
// Set
setProgressBarIndeterminateVisibility(false);
}
}
Yes you can do that using Javascript interface. Check this documentation for more information on how to call native android methods from javascript.
You can write your methods to set the progressbar indeterminate visibility to true/false from these methods and call these methods from your Ajax calls.
精彩评论