1、权限

<uses-permission android:name="android.permission.INTERNET"/>

2、代码

//这次的HttpURLConnection仅针对Http连接,效率胜于URLConnection。
String uriPic =et.getText().toString();

URL imageUrl = null;
Bitmap bitmap = null;
try{
imageUrl = new URL(uriPic);// new URL对象将网址传入
}
catch (MalformedURLException e){
e.printStackTrace();
}
try{
HttpURLConnection conn = (HttpURLConnection) imageUrl.openConnection();// 取得连接
conn.connect();
InputStream is = conn.getInputStream();//取得返回的InputStream
bitmap = BitmapFactory.decodeStream(is);//将InputStream变成Bitmap
is.close();//关闭InputStream
}catch (IOException e){
e.printStackTrace();
}
iv.setImageBitmap(bitmap);