相关疑难解决方法(0)

Java Generics - 这个语法是什么?

下面这部分代码<String, Void, Bitmap>是什么意思?我甚至都不知道甚至调用了这种语法.

private class DownloadImageTask extends AsyncTask<String, Void, Bitmap> {

}
Run Code Online (Sandbox Code Playgroud)



这是原始代码(从这里找到: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
      * …
Run Code Online (Sandbox Code Playgroud)

java generics android

1
推荐指数
1
解决办法
364
查看次数

标签 统计

android ×1

generics ×1

java ×1