March 2013
Beginner to intermediate
580 pages
16h 11m
English
Create a new class called ThumbnailDownloader that extends HandlerThread. Your ThumbnailDownloader’s user will need to use some object to identify each download, so give it one generic argument called Token by naming it ThumbnailDownloader<Token> in the class creation dialog. Then give it a constructor and a stub implementation of a method called queueThumbnail() (Listing 27.2).
Listing 27.2 Initial thread code (ThumbnailDownloader.java)
public class ThumbnailDownloader<Token> extends HandlerThread {
private static final String TAG = "ThumbnailDownloader";
public ThumbnailDownloader() {
super(TAG);
}
public void queueThumbnail(Token token, String url) {
Log.i(TAG, "Got an URL: " + url);
}
}
Notice that queueThumbnail() ...
Read now
Unlock full access