Android ~ Muliti Thread ~ AsyncTask

有時候像對某url做要求

會導致死雞.............直到動作完成為止

這時候就要用多執行續~~~~~

大致上就是創一個新物件~~~~~繼承AsyncTask並實作一些函式~


okButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
new sendDogStatus(number, zip).execute(null);
}
});

-----------------------------------

private class sendDogStatus extends AsyncTask< String, Integer, Void >{
private String zzzzzzzz;
private String xxxxxxxx;
public sendOrderStatus(String number, String zip){
this.zzzzzzzz= number;
this.xxxxxxxx= zip;
}

protected Void doInBackground(String... param)
{
String url = "http://ggyyyyyyyyyyyyyyyyyyy";
//do something
}
} catch (Exception e) {
}

return null;
}
}


reference
http://developer.android.com/reference/android/os/AsyncTask.html

2 則留言:

匿名 說...

kenneth j lane jaguar handbag 1970 ford mustang coupe rear chrome car engine break in amega mini scout mount car is louder then normal

匿名 說...

haddad hyundai ford e350 fuse box diagram gmc v6 engine denki car car ownership document