所以我正在开发一个应用程序来接收文件并将其上传到FTP服务器,但我不断获得android.os.NetworkOnMainThreadException。有想法该怎么解决这个吗? 这是我的代码
function createFlashMovie(blobUrl){
var obj = document.createElement("object");
obj.setAttribute("width", "800");
obj.setAttribute("height", "600");
obj.setAttribute("type", "application/x-shockwave-flash");
obj.setAttribute("data", blobUrl); //use the object url here
document.body.appendChild(obj);
}
FTPUploader类:
public void sendData() throws Exception {
FTPUploader stuff = new FTPUploader("xxx","xxx","xxx");
stuff.doInBackground();
}
答案 0 :(得分:1)
您需要从主要活动或类别而不是doInBackground()
进行调用new FTPUploader()。execute(param1,param2,param3);