首先 定义一张图片地址
private String IMAGE_FILE_NAME;
private Uri imageUri;
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmss");// HH:mm:ss
//获取当前时间
Date date = new Date(System.currentTimeMillis());
IMAGE_FILE_NAME = simpleDateFormat.format(date) + "temp.jpg";
imageUri = Uri.fromFile(new File(Environment.getExternalStorageDirectory(), IMAGE_FILE_NAME));
跳转相机 相册选择图片
private View.OnClickListener itemsOnClick = new View.OnClickListener() {
@Override
public void onClick(View v) {
selectPicPopupWindow.dismiss();
switch (v.getId()) {
// 拍照
case R.id.takePhotoBtn:
Intent takeIntent = new Intent(MediaStore.ACTION_IMAG