出处:https://www.jianshu.com/p/eea5cc5ab9de
自己参考做的demo:https://github.com/cag2050/AndroidDemo/blob/master/app/src/main/java/com/example/androiddemo/DownloadImageJavaActivity.java