I have a website which is displayed in a Android Webview App.
I use JqueryMobile (1.10.2) and the ChangePage method in order to navigate through my website. Pages ask a webservice so they can take time to be displayed.
I want to display a Toast (Android) during the page is loading. It works, but I don't know how to know when my page is loaded
My question is: It is possible to know when the page is loaded by the $.ChangePage method in order to hide my Android Toast ?
Here my code:
$('div.ui-page').swipeleft(function (e) {
//$("#pop").popup("open");
window.Android.showToast();
$.mobile.changePage("mypage", {
transition: "slide"
});
})
Into my Android App (with @JavascriptInterface):
@JavascriptInterface
public void hideToast() {
if(wait > 0) {
wait--;
}
if(wait == 0) {
montoast.cancel();
}
}
public void showToast() {
wait++;
montoast.setText("loading...");
montoast.show();
}
jQuery( ".selector" ).on( "pagechange", function( event ) { ... } )
This event is triggered after the changePage() request has finished loading the page into the DOM and all page transition animations have completed
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.