Skip to content

Instantly share code, notes, and snippets.

@shaobin0604
Created December 8, 2009 07:56
Show Gist options
  • Select an option

  • Save shaobin0604/251506 to your computer and use it in GitHub Desktop.

Select an option

Save shaobin0604/251506 to your computer and use it in GitHub Desktop.
package cn.yo2.aquarium.webviewtest;
import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;
public class Main extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
String data = "<a href=\"http://sian.com/msnportal/redirectTitle.do?id=1\">中文 utf-8 编码</a>";
WebView webView1 = (WebView) findViewById(R.id.webview_1);
webView1.loadData(data, "text/html", "utf-8");
WebView webView2 = (WebView) findViewById(R.id.webview_2);
webView2.loadDataWithBaseURL("", data, "text/html", "utf-8", "");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment