Three methods to solve the slow opening of Android help documentation

Source: Internet
Author: User

The reason is that the webpage in the local document has the following two sections of js code that will load information online. Just comment it out.

 

<link rel="stylesheet"href="http://fonts.googleapis.com/css?family=Roboto:regular,medium,thin,italic,mediumitalic,bold" title="roboto">

 

 <script src="http://www.google.com/jsapi" type="text/javascript"></script>

Use the following Java code to comment in batches

/** Remove the JavaScript code that requires Internet connection in the android document */import Java. io. bufferedreader; import Java. io. bufferedwriter; import Java. io. file; import Java. io. filenotfoundexception; import Java. io. filereader; import Java. io. filewriter; import Java. io. ioexception; public class formatdoc {public static Int J = 1;/*** @ Param ARGs */public static void main (string [] ARGs) {file = new file ("D:/Android-SDK-Windows/docs/ "); Searchdirectory (file, 0); system. Out. println (" over ");} public static void searchdirectory (file F, int depth) {If (! F. isdirectory () {string filename = f. getname (); If (filename. matches (". *. {1} html ") {string src =" <(LINK rel) [=] \ "(stylesheet) \" \ n (href) [=] \ "(HTTP): // (fonts.googleapis.com/css) [?] (Family) [=] (Roboto) [:] (regular, medium, thin, italic, mediumitalic, bold) \ "(title) [=] \ "Roboto \"> "; string src1 =" <SCRIPT src = \ "http://www.google.com/jsapi\" type = \ "text/JavaScript \"> </SCRIPT> "; string DST = ""; // if it is an HTML file, comment out the specific JavaScript code annotation (F, SRC, DST); annotation (F, src1, DST );}} else {file [] FS = f. listfiles (); depth ++; For (INT I = 0; I <FS. length; ++ I) {file = FS [I]; searc Hdirectory (file, depth );}}} /** F file in which specific content will be modified * SRC content to be replaced * DST content to be replaced */public static void annotation (file F, string SRC, string DST) {string content = formatdoc. read (f); content = content. replacefirst (SRC, DST); int LL = content. lastindexof (SRC); system. out. println (LL); formatdoc. write (content, f); system. out. println (J ++); return;} public static string read (File SRC) {stringbuffer re S = new stringbuffer (); string line = NULL; try {bufferedreader reader = new bufferedreader (New filereader (SRC); int I = 0; while (line = reader. readline ())! = NULL) {if (I! = 0) {res. append ('\ n');} res. append (line); I ++;} reader. close ();} catch (filenotfoundexception e) {e. printstacktrace ();} catch (ioexception e) {e. printstacktrace ();} return res. tostring ();} public static Boolean write (string cont, file Dist) {try {bufferedwriter writer = new bufferedwriter (New filewriter (DIST); writer. write (cont); writer. flush (); writer. close (); Return true;} catch (ioexception e) {e. printstacktrace (); Return false ;}}}

 

There is a way to delete the line of JS Code through shell, which is very simple and convenient, 100 times more convenient than the above Java, but cannot delete the first JS Code

find . -name "*.html"|xargs grep -l "jsapi"|xargs sed -i '/jsapi/d'

Another method is to disconnect the network, or use IE or Firefox to browse offline.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.