下面这部分代码<String, Void, Bitmap>
是什么意思?我什至不知道这种语法叫什么。
private class DownloadImageTask extends AsyncTask<String, Void, Bitmap> {
}
这是原始代码(从这里找到:http: //developer.android.com/guide/components/processes-and-threads.html):
public void onClick(View v) {
new DownloadImageTask().execute("http://example.com/image.png");
}
private class DownloadImageTask extends AsyncTask<String, Void, Bitmap> {
/** The system calls this to perform work in a worker thread and
* delivers it the parameters given to AsyncTask.execute() */
protected Bitmap doInBackground(String... urls) {
return loadImageFromNetwork(urls[0]);
}
/** The system calls this to perform work in the UI thread and delivers
* the result from doInBackground() */
protected void onPostExecute(Bitmap result) {
mImageView.setImageBitmap(result);
}
}