关于android.os.NetworkOnMainThreadException的问题
public Bitmap getBitmapFromURL(String urlString){
Bitmap bitmap = null;
InputStream is=null ;
try {
URL url=new URL(urlString);
HttpURLConnection connection=(HttpURLConnection) url.openConnection();
is=new BufferedInputStream(connection.getInputStream());
bitmap=BitmapFactory.decodeStream(is);
connection.disconnect();
return bitmap;
} catch (Exception e) {
e.printStackTrace();
}
如果把Exception改成IOException程序就会崩溃,我获取了线程名字当前线程不是主线程啊为什么异步处理也会有这个警告