January 2017
Beginner to intermediate
624 pages
22h 42m
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() method that signals when your thread has quit. (Toward the end of the chapter, you will need this bit of information.)
Listing 26.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 ...Read now
Unlock full access