1、下载源码导入库或添加依赖
2、build.gradle配置
android{
useLibrary 'org.apache.http.legacy'
}
3、封装成工具类
(1)在Application里面new一个RequestQueue,再暴露一个getRequestQueue方法返回RequestQueue对象;

(2)写一个接口

(3)在工具类里面实现get和post方法

先写个方法拿到接口对象

get

post
(4)Activity里面使用

写两个方法分别调用HttpUtilL工具类的doPost和doGet方法

(5)请求网络图片

方法一(推荐)

方法二

调用