RT, the company has developed a mobile web game, the page used a lot of pictures, consider loading speed and traffic consumption, and now you want the picture above html, swf, etc. on the local, seeking expert answers, Android's WebView how to load these resources In making this judgment, and abort the load request to load it directly from the local?
sdk3.0 more open such an interface, but below 3.0 on the tangled, this problem has been studied for two weeks, in addition to the current feel like change page, or explore the webkit framework to achieve, but could not find a solution ...... < br />In this game ios side shelves, change the page too much work, company executives directly negates (Also, read out the entire page saved locally, and then modify the path to self-image, because it was the page design did not consider this problem , a mess of things on the page, this program does not work).
Now the solution on the left and the underlying research framework to explore mechanisms webview cache implementation (the principle of cache is also the picture on the local, and then determine whether to use when loading the cache, and then replace the network resources according to the judgment result), cache to achieve, the program also will be able to achieve, looked under the android source code, webview loads of things to too many resources involved (just a class webview source has thousands of rows, and related to the class has dozens ......) , saw two weeks, Leng Shimo see a little clue.
Card on this issue has been half a month, and even veterans of the game has been suspended transplant, let me take the time to carefully study this thing, it makes very tangled, feeling himself in the eyes of veterans drop to the next level .
Great God and the brightest who, on the great God who webview very familiar, help out, or who have done something in this area, to provide an idea of the next bar.
Bese!<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Click cache design principles attempt to try and source is powerful and complex, the need to slowly explore, do not worry, all learning by doing
Reply:
The first way to get the page with get data from the web to find the corresponding image data inside path swf will replace these paths into your local file path, replace good content and save the file to a local website, then let webView The page file is loaded locally.
Reply:
caching involves things too much, totally do not understand, then think of is to understand this mechanism, then rewrite webview, but I looked down and found involved class is much more than simple webview, webview load the page, a lot of classes, modules cooperating, just simply nothing in rewriting webview up, I feel this can only be webview page loads completely rewritten ...... even spent a few months to get understand the caching mechanism, nor can it be used in the project, because I am doing is not a system customized applications, even modify the source code, but also affect the user's machine less tangled ah ......
Reply:
Thank you, this method has been tried, and then ruled out, because the problem involves a lot, to do so even more complex than the change server pages:
1, how to filter the page image tag, is a big problem, to keep down the page slowly judgment, not directly modify the page, I believe that the workload is much smaller (there may android screening mechanism, but the page design will not be considered encounter this problem, so the page design is very confusing, such as many labels written in one line, which also increases the difficulty of screening)
2, even if the first issue is resolved, but the project, not all of the images should be placed locally, how to determine what you want to replace the picture is a problem
These two are the biggest problem, there are a lot of small problems, details, etc. ...... So now not only think of ways to move the page (either server or save the page and then change), but to achieve this function
Reply:
Go to the top, do not sink ~ ~ line waiting for the god! !
Reply:
You can save the image url and requires replacement to replace the picture address to the database, since the data in html Direct Access database, get the picture you want to replace the address, if there is no check to the direct use of html in the url.
Reply:
When searching with the replacement, you can also have a third-party package is relatively easy to find, jsoup.jar
Reply:
What is your final solution to this problem is?
Reply:
Resign?

Reply:
Reply:
There is no tried phonegap?
No comments:
Post a Comment