upload
来源:互联网 发布:微信猪淘客软件多少钱 编辑:程序博客网 时间:2024/05/16 08:38
//上传头像
@Override
public void onClick(View view) {
//父布局
View parentlayout = LayoutInflater.from(LoginCancelActivity.this).inflate(R.layout.activity_out, null);
View poplayout = LayoutInflater.from(LoginCancelActivity.this).inflate(R.layout.popupwindow_layout, null);
popwindow = new PopupWindow(poplayout, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT,true);
popwindow.setContentView(poplayout);//设置布局
//找到控件
Button pai = (Button) poplayout.findViewById(R.id.pop_pai);
Button choose = (Button) poplayout.findViewById(R.id.pop_choose);
Button cancel = (Button) poplayout.findViewById(R.id.pop_cancel);
//取消
cancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
popwindow.dismiss();
}
});
//选择照片
choose.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(Intent.ACTION_PICK);
intent.setType("image/*");
startActivityForResult(intent,001);
}
});
//拍照
pai.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
/*Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.setType("image*//**//*");
startActivityForResult(intent,002);*/
}
});
popwindow.showAtLocation(parentlayout, Gravity.BOTTOM,0,0);//设置弹出框在正下方显示
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {super.onActivityResult(requestCode, resultCode, data);
if(requestCode == 001){
Uri imageuri = data.getData();
Glide.with(this).load(imageuri).into(logincancel_user);
//调用工具类的方法,将imageuri转成绝对路径
String absolutePath = UriToPathUtil.getImageAbsolutePath(this, imageuri);
//ImageLoader.getInstance().displayImage(absolutePath,logincancel_user, ImageLoaderUtil.getroundedoption());
File file = new File(absolutePath);
//上传头像
Map<String, String> map = new HashMap<>();
map.put("uid",uid+"");
OkHttp3Util.uploadFile(this,"https://www.zhaoapi.cn/file/upload",file,"aa.jpg",map);
popwindow.dismiss();
}
}
- upload?
- upload
- upload
- upload
- upload
- upload
- upload
- upload
- Upload
- upload
- Upload
- upload
- upload.aspx
- asp Upload
- servlet upload
- Ajax Upload
- 微软upload
- upload file
- 程序员,这样面试,你的成功率能达到 90%!
- AI 全面入侵,程序员到了 2040 年还能继续敲代码吗?
- 论文阅读-《Learning Deep Features for Discriminative Localization》
- NIO相关基础篇二
- GDB使用方法小记
- upload
- 紧凑存储的杜利特尔分解法Doolittle(LU分解法)_解线性方程组的直接解法
- CommonUtils 工具类
- 购物车
- Codeforces 899
- FreeBASIC学习笔记——FireFly常用控件之窗体(Form)
- 克洛特分解法Crout_解线性方程组的直接解法
- 购物车1
- 紧凑存储的克洛特分解法Crout_解线性方程组的直接解法