V
V
Vadim2016-05-06 14:15:00
JavaScript
Vadim, 2016-05-06 14:15:00

Android. How to remove brakes in WebView when JavaScript function is used?

Good afternoon!
I am writing an Android application and it has a WebView. Through the loadUrl() method, I call a JavaScript function that passes in my position and draws a marker.
It looks like this:

webView.post(new Runnable() {
            @Override
            public void run() {
                webView.loadUrl("javascript:send_location(" + x + ", " + y + ")");
            }
        });

I call this function every second, but over time, the performance of the View element (WebView) starts to go to zero. The application itself works correctly and all other elements of the application do not suffer in any way.
What could be the reason? Tried various ways to solve the problem, but they did not help.
P. S The application memory does not suffer, the marker is drawn once, and then it only moves.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Elysey, 2016-05-07
@Elysey

Alternatively, you can try Crosswalk as a replacement for the standard WebView.
https://habrahabr.ru/post/263649/

O
OM1, 2016-07-12
@OM1

Apnu question - faced something similar. How to speed up webview?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question