点击头像,调用相机,相册改变头像
来源:互联网 发布:逆战刷箱子淘宝 编辑:程序博客网 时间:2024/05/29 08:03
imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { AlertDialog.Builder builder=new AlertDialog.Builder(Main3Activity.this); builder.setPositiveButton("相机", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Intent intent=new Intent(MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(intent, 1000); } }); builder.setNegativeButton("相册", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Intent intent=new Intent(Intent.ACTION_PICK); intent.setType("image/*"); startActivityForResult(intent, 2000); } }); builder.create().show(); //drawerLayout.closeDrawer(relativeLayout); }});
//重写方法
@Overrideprotected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if(requestCode==1000 && resultCode==RESULT_OK){ Bitmap bm = data.getParcelableExtra("data"); imageView.setImageBitmap(bm); }else if(requestCode==2000&&resultCode==RESULT_OK ){ Uri uri = data.getData(); imageView.setImageURI(uri); }}
阅读全文
0 0
- 点击头像,调用相机,相册改变头像
- iOS调用相机,相册,上传头像
- android调用手机相机、相册,设置头像
- iOS 调用相机,获取相册,截取头像
- 调用系统相册,相机设置圆形头像
- 调用系统相机相册上传头像
- 调用系统相机/相册,实现更改头像
- 更改头像 相册/相机
- Android调用系统相机或相册更换头像
- iOS调用系统相册,相机上传头像的基本技巧
- Android头像上传(本地相册和调用系统相机)
- 安卓头像更换,调用系统相机,或从相册修改头像
- html5调用相册修改头像
- android圆形头像:相机相册加载图片到圆形头像
- 实现显示圆形头像及选择相册相机修改头像
- iOS 头像选取 (相机或相册)
- 【iOS开发系列】更换头像(相机、相册)
- Android 相机或者相册上传头像
- centos7下安装mysql5.7.20
- 后端修改密码的简单弹窗
- 自定义toast
- Linux上nginx安装配置(配置虚拟主机,静态资源)
- Android swiperefreshlayout 实现上拉刷新 加载
- 点击头像,调用相机,相册改变头像
- 游戏内统一支付系统设计与实现
- Spark存储与读取文件方法小结
- Twemproxy+ssdb双主配置
- eXtremeDB内存数据库7.0新版本的强大功能加强了它在物联网的关键作用
- Java并发编程(四)未处理异常、线程池和ThreadLocal类
- 多线程-共享全局变量(python版)
- 事务
- 前端笔记