July 2015
Beginner to intermediate
600 pages
18h 59m
English
Create a new class called ThumbnailDownloader that extends HandlerThread. Then give it a constructor, a stub implementation of a method called queueThumbnail(), and an override of the quit() that signals when your thread has quit (you will need this later) (Listing 24.4).
Listing 24.4 Initial thread code (ThumbnailDownloader.java)
public class ThumbnailDownloader<T> extends HandlerThread {
private static final String TAG = "ThumbnailDownloader";
private boolean mHasQuit = false;
public ThumbnailDownloader() {
super(TAG);
}
@Override
public boolean quit() {
mHasQuit = true;
return super.quit();
}
public void queueThumbnail(T target, String url) {
Log.i(TAG, "Got a URL: " + url);
}
}
Notice you ...
Read now
Unlock full access