@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_aboutus);
Intent incoming = getIntent();
Bundle extras = incoming.getExtras();
String uri = "html/about.html";
if(extras != null){
uri = extras.getString(EXTRA_HTML_URI);
}
mWebView = (WebView) findViewById(R.id.webView);
mCloseBtn = (ImageButton) findViewById(R.id.closeButton);
mCloseBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed();
}
});
InputStream is;
String htmlData = "";
try {
is = this.getAssets().open(uri);
BufferedReader r = new BufferedReader(new InputStreamReader(is));
StringBuilder stringBuilder = new StringBuilder();
String line;
while( (line=r.readLine()) != null ) {
stringBuilder.append(line);
}
htmlData = stringBuilder.toString();
} catch( IOException error ) {}
mWebView.loadDataWithBaseURL("file:///android_asset/", htmlData, "text/html", "utf-8", "about:blank");
}
LocalWebActivity.java 文件源码
java
阅读 25
收藏 0
点赞 0
评论 0
项目:Tech-Jalsa
作者:
评论列表
文章目录