平时遇见的错误集合

问题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;

 

posted @ 2015-01-15 20:51  月轩  阅读(125)  评论(0编辑  收藏  举报