2

I am using a custom List View that contains some components like Image View, Text View and Web View. I am using a List View because the data is not fixed and changes after every item click. So due to dynamic data I am using a list view, I am using BaseAdapter for this.

In WebView I am displaying some Math expressions. For that I need local Javascript: all works fine but it takes around 4 to 5 seconds to load Javascript in WebView. After that, it starts rendering, so the total time to display output is 5 to 6 seconds.

I want to reduce this time. Is there any way that I can preload Javascript in WebView?

The GetView() method every time creates a new instance of WebView and other components, so every time it's loading Javascript.

Is there any way in that I can use a preloaded Javascript Webview?

dda
  • 6,030
  • 2
  • 25
  • 34
Mac
  • 1,153
  • 2
  • 20
  • 34

2 Answers2

0

I think you should go through a library JAVA / Android to avoid the use of webview and thus improve performance. Here is a topic that addresses the problem of mathematical expressions: MathML and Java

Community
  • 1
  • 1
throrin19
  • 17,796
  • 4
  • 32
  • 52
0

Dont have a solution for initial delay but subsequent delay to load the page when you scroll list view can be avoided by caching the html-page that is dynamically created by js.

You can associate each result (html result page) with an unique id (generated based on result to be rendered) and cache dynamically created html page in hashmap or lru cache (completely created page can be accessed after onPageFinished call back) against this id. When the list is scrolled up or down, instead of creating page dynamically by js again, you can fetch cached html page (now static page) that was created and just load the static page. This reduces the delay to load page as well as saves battery

Jeevan
  • 8,532
  • 14
  • 49
  • 67