如果不是通过代码上传的,www文件夹是根目录文件夹,图片地址为:http://你的域名/img/name.jpg
直接获取bitmap对象
// 传输网络图片
public Bitmap getPic(String uriPic) {
URL imageUrl = null
Bitmap bitmap = null
try {
imageUrl = new URL(uriPic)
} catch (MalformedURLException e) {
e.printStackTrace()
}
try {
HttpURLConnection conn = (HttpURLConnection) imageUrl
.openConnection()
conn.connect()
InputStream is = conn.getInputStream()
bitmap = BitmapFactory.decodeStream(is)
is.close()
} catch (IOException e) {
e.printStackTrace()
}
return bitmap
}
欢迎分享,转载请注明来源:夏雨云
评论列表(0条)