修改方法1:
在setContentView(R.layout.activity_main)下添加:
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
方法2:新开线程
new Thread(httpget).start();
/**
* 下载线程
*/
Runnable httpget= new Runnable(){
@Override
public void run() {
// TODO Auto-generated method stub
httpgetmethod();
}
};
网友回复