Function not found


#1

Hi, I’m trying to call the function enableSlowWholeDocumentDraw on a webview, here’s my code so far:

webViewLoaded(args: EventData){
    if (isAndroid && android.os.Build.VERSION.SDK_INT >= 21){
        let myWebView: WebView = <WebView>args.object;            
        myWebView.android.enableSlowWholeDocumentDraw();           
    }           
}

And the html file:

<WebView id=“myWebView” row=“0” (loaded)=“webViewLoaded($event)” [src]=“url”>

When I try to call enableSlowWholeDocumentDraw I receive the message “JS: ERROR TypeError: myWebView.android.enableSlowWholeDocumentDraw is not a function”. I’ve tried to run on emulator with the command-line tns run android --compileSdk 23 but it still not work.

Edit: The emulator is running android 6.0


#2

enableSlowWholeDocumentDraw is a satic method, you are trying to call it on an instance. You may try android.webkit.WebView.enableSlowWholeDocumentDraw() from your app.ts or app.module.ts in case of Angular.


#3

Thank you! I finally solved the problem. I had to generate the metadata for android API 23 and chall the static function as you said.