蓝牙信号
断点续传
效果: 文件里的中文就会乱码
Xutils控件
导依赖
implementation 'org.xutils:xutils:3.3.4'
公共类
主类
package com.example.study_fivtween;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import org.xutils.common.Callback;
import org.xutils.http.RequestParams;
import org.xutils.x;
public class MainActivity extends AppCompatActivity {
ImageView imageView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button button=findViewById(R.id.but);
imageView=findViewById(R.id.image);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
x.image().bind(imageView,"http://pic25.nipic.com/20121205/10197997_003647426000_2.jpg");
// x.http().get(new RequestParams(), new Callback.CommonCallback<String>() {
// @Override
// public void onSuccess(String result) {
// //显示到TextView
// }
//
// @Override
// public void onError(Throwable ex, boolean isOnCallback) {
//
// }
//
// @Override
// public void onCancelled(CancelledException cex) {
//
// }
//
// @Override
// public void onFinished() {
//
// }
// });
// RequestParams parames = new RequestParams("网址");
// parames.addQueryStringParameter("page","2");
// parames.addQueryStringParameter("name","wz");
// x.http().post(parames, new Callback.CommonCallback<String>() {
// @Override
// public void onSuccess(String result) {
//
// }
//
// @Override
// public void onError(Throwable ex, boolean isOnCallback) {
//
// }
//
// @Override
// public void onCancelled(CancelledException cex) {
//
// }
//
// @Override
// public void onFinished() {
//
// }
// });
}
});
}
}