平时碰见的错误集合

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

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

 

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

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

 

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

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

相关文章
相关标签/搜索