| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- package com.usai.redant.photo;
- import java.io.InputStream;
- import org.apache.http.util.EncodingUtils;
- import android.app.Activity;
- import android.os.Bundle;
- import android.view.Menu;
- import android.view.MenuItem;
- import android.webkit.WebView;
- public class LicenseActivity extends Activity
- {
- @Override
- protected void onCreate(Bundle savedInstanceState)
- {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_license);
- WebView wv = (WebView) findViewById(R.id.webView1);
- String content = "";
- try
- {
- InputStream in = getResources().openRawResource(R.raw.license);
- // 获取文件的字节数
- int lenght = in.available();
- // 创建byte数组
- byte[] buffer = new byte[lenght];
- // 将文件中的数据读到byte数组中
- in.read(buffer);
- content = EncodingUtils.getString(buffer, "UTF-8");
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- wv.getSettings().setDefaultTextEncodingName("UTF-8");
- wv.loadData(content, "text/html", null);
- }
- // @Override
- // public boolean onCreateOptionsMenu(Menu menu)
- // {
- // // Inflate the menu; this adds items to the action bar if it is present.
- // getMenuInflater().inflate(R.menu.license, menu);
- // return true;
- // }
- //
- // @Override
- // public boolean onOptionsItemSelected(MenuItem item)
- // {
- // // Handle action bar item clicks here. The action bar will
- // // automatically handle clicks on the Home/Up button, so long
- // // as you specify a parent activity in AndroidManifest.xml.
- // int id = item.getItemId();
- // if (id == R.id.action_settings)
- // {
- // return true;
- // }
- // return super.onOptionsItemSelected(item);
- // }
- }
|