Tomcat和Xutils
tomcat 轻量级的服务器
1、配置环境变量
2、startup.bat
3、webapps/ROOT/自定义文件
界面有小猫表示成功
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/bcaa3cbc13f598303953b32ce11eef68.png)
依赖
implementation ‘org.xutils:xutils:3.5.1’
自定义
public class MyAppaction extends Application {
@Override
public void onCreate() {
super.onCreate();
x.Ext.init(this);
}
}
Xutils下载图片
String url1="https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=167219548,1510840028&fm=27&gp=0.jpg";
x.image().bind(imageView, url1);
效果
XutilsGet下载
String str="http://www.qubaobei.com/ios/cf/dish_list.php?stage_id=1&limit=10&page=1";
x.http().get(new RequestParams(str), new Callback.CacheCallback<String>() {
@Override
public void onSuccess(String result) {
Log.e("###1",result.toString());
}
@Override
public void onError(Throwable ex, boolean isOnCallback) {
}
@Override
public void onCancelled(CancelledException cex) {
}
@Override
public void onFinished() {
}
@Override
public boolean onCache(String result) {
return false;
}
});
Xutilspot下载
String str="http://www.qubaobei.com/ios/cf/dish_list.php?stage_id=1&limit=10&";
RequestParams requestParams = new RequestParams(str);
requestParams.addQueryStringParameter("page","2");
x.http().post(requestParams, new Callback.CacheCallback<String>() {
@Override
public void onSuccess(String result) {
Log.e("####2",result.toString());
}
@Override
public void onError(Throwable ex, boolean isOnCallback) {
}
@Override
public void onCancelled(CancelledException cex) {
}
@Override
public void onFinished() {
}
@Override
public boolean onCache(String result) {
return false;
}
});