平时遇见的错误集合

问题1:实例化一个Thread并start()之后,等待这个线程isAlive()==false 时再次去start()该线程时会报如下错误:the thread already started;

解决方法:每次start()线程之前都要重新实例化一次;

问题2:使用HttpURlConnection.getResponseCode()方法时报错:NetMainThreadException;

解决方法:在主线程中不能进行网络请求,另起一个线程才可以;

问题3:在new AlertDialog.builder().setView(view)后,第二次显示该Dialog时报错:the view is 。。。。must remove first。。。。;

解决方法:每次;new AlertDialog.builder().setView(view)之前要重新inflate这个view;

原文地址:https://www.cnblogs.com/csxcode/p/4227248.html