// 获取指定路径的图片 public static Bitmap getImage(String urlpath) throws Exception { URL url = new URL(urlpath); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); conn.setConnectTimeout(5 * 1000); Bitmap bitmap = null; if (conn.getResponseCode() == 200) { InputStream inputStream = conn.getInputStream(); bitmap = BitmapFactory.decodeStream(inputStream); } return bitmap; }
android如何获取url指定的图片资源
猜你喜欢
转载自kylines.iteye.com/blog/1660180
今日推荐
周排行