1. Create a raw folder under Res to place HTML files.
2. Create an HTML file in raw: mypage.html
<! Doctype HTML public "-// W3C // dtd html 4.01 // en" "http://www.w3.org/TR/REC-html40/strict.dtd">
<HTML>
<Head>
<Title> actuate viewer </title>
</Head>
<Body>
<H1> This is body !! </H1>
<H2> This is Franch !! Adobe a annoncé hier que un comprim é
Optimis é e-Flash Player 10.2 sera pr é-install é sur certains des
Ardoises, mais il sera un t é chargement OTA pour la plupart des
Tablettes honeycomb Android disponible en «Quelques semaines». ce que
Cela signifie est que le dispositif de lancement de honeycomb, le xoom
Motorola qui sera disponible ce jeudi, VA navire sans Flash Player. En
Fait une annonce pour le xoom Verizon é quip é cot es... </H2>
<A href = "http://www.blabla.cn" target = "_ blank"> open a new page1. </a>
<A href = "http://www.blabla.cn" target = "_ Self"> open a new page2. </a>
</Body>
</Html>
3. Android activity:
Private webview mwebview;
/** Called when the activity is first created .*/
@ Override
Public void oncreate (bundle savedinstancestate ){
Super. oncreate (savedinstancestate );
Setcontentview (R. layout. Main );
Mwebview = (webview) findviewbyid (R. Id. agendize );
Mwebview. setwebviewclient (New mywebviewclient ());
Mwebview. setwebchromeclient (New mywebchromeclient ());
Findviewbyid (R. Id. btnsend). setonclicklistener (New onclicklistener (){
@ Override
Public void onclick (view v ){
// For email
// String HL =
// "<HTML> <title> AAA </title> <body> It is body </body> // Intent it = new intent (intent. action_send );
// It. putextra (intent. extra_text, HTML. fromhtml (HL ));
// It. settype ("text/plain ");
// Startactivity (intent. createchooser (it,
// "Choose email client "));
// For webview
Mwebview. loadurl ("file: // android_res/raw/mypage.html ");
}
});
}
/* Mobile End */
String convertdatetostring (date, string format ){
Dateformat = new simpledateformat (format );
Return dateformat. Format (date );
}
Public class mywebviewclient extends webviewclient {
@ Override
Public Boolean shouldoverrideurlloading (webview view, string URL ){
View. loadurl (URL );
Return true;
}
@ Override
Public void onpagestarted (webview view, string URL, bitmap favicon ){
}
@ Override
Public void onpagefinished (webview view, string URL ){
}
}
Private class mywebchromeclient extends webchromeclient {
@ Override
Public void onprogresschanged (webview view, int newprogress ){
}
@ Override
Public void onreceivedtitle (webview view, String title ){
Super. onreceivedtitle (view, title );
}
}