在加载bitmap时遇到系统线程报错,通过参考https://developer.android.com/guide/components/processes-and-threads.html#Processes
解决了问题,代码:
public static void setPic(final ImageView ivPic, final String pic_url){ new Thread(new Runnable() { @Override public void run() { try { HttpURLConnection urlConnection=(HttpURLConnection)new URL(pic_url).openConnection(); urlConnection.connect(); InputStream is=urlConnection.getInputStream(); final Bitmap bitmap= BitmapFactory.decodeStream(is); ivPic.post(new Runnable() { @Override public void run() { ivPic.setImageBitmap(bitmap); } }); is.close(); } catch (IOException e) { e.printStackTrace(); } } }).start();