我正在使用AsyncTask,并想知道将参数传递给构造函数的含义是什么,而不是直接将它们传递给doInBackground(…)方法的execute()调用,例如:
呼叫:
new SoMetask(bitmap,integer,"somestring").execute();
类:
public class SoMetask extends AsyncTask<Void,Void,String> { private String string; private Bitmap image; private int integer; public SoMetask (Bitmap bmp,int someint,String s){ this.image = bmp; this.string = s; this.integer = someint; } protected String doInBackground(Void... params) { // whatever return "string"; } @Override protected void onPostExecute(String result){ // whatever }
}
设计,优雅,重用和性能有哪些优点/缺点?
谢谢.