我想从网上获取 html,但我不能。这是我的代码
final EditText et = (EditText) findViewById(R.id.editText1);
final TextView tv = (TextView) findViewById(R.id.textView1);
final Button b = (Button) findViewById(R.id.button1);
b.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
try {
URL url = null;
url = new URL(et.getText().toString());
URLConnection conn = url.openConnection();
BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line;
while ((line = reader.readLine()) != null) {
tv.append(line);
}
} catch (Exception e) {
Log.e("error", "erorr connection "+ e.toString());
}
}
});
我也已经添加了来自互联网的许可。目标版本 4.0.3