Created
September 7, 2016 05:06
-
-
Save jsaund/6fb06bd980ec700cbf0f45c04e9b2f1d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ImageFetcherActivity extends AppCompactActivity { | |
class WorkerThread extends Thread { | |
void fetchImage(String url) { | |
// network logic to create and execute request | |
handler.post(new Runnable() { | |
@Override | |
public void run() { | |
imageView.setImageBitmap(image); | |
} | |
}); | |
} | |
} | |
@Override | |
protected void onCreate(@Nullable Bundle savedInstanceState) { | |
// prepare the view, maybe setContentView, etc | |
new WorkerThread().fetchImage(imageUrl); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment