@Override
    public void onClick(View v) {
      Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");

      FileService service = new FileService(getApplicationContext());
      photoFilePath = service.getPhotoFilePath();
      intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(photoFilePath)));

      startActivityForResult(intent, 2);

      popSelectPic.dismiss();
    }
    @Override
    public void onClick(View v) {

      // 下面是保存的按钮响应,现将页面上信息获取到editnote中
      String editContent = etEditContent.getText().toString();
      if (editContent.length() == 0) {
        Toast.makeText(getApplicationContext(), "Text should not be empty", 1000).show();
      } else if (editContent.length() > 100) {
        Toast.makeText(getApplicationContext(), "Text should not be more than 100", 1000).show();
      } else {
        String editTitle = etEditTitle.getText().toString();

        if (editTitle.length() == 0) {
          if (editContent.length() < 5) {
            editTitle = editContent;
          } else {
            editTitle = editContent.substring(0, 5);
          }
        }

        // 图片处理

        FileService service = new FileService(getApplicationContext());
        String fileName = "/easyTravel/savefile/images/";
        service.createSDCardDir(fileName);

        String cfsFileName = "/easyTravel/savefile/tempImages/";
        service.createSDCardDir(cfsFileName);
        for (int i = 0; i < pictureNum; i++) {

          try {
            // 将原图片保存在/savefile/images文件夹下,并且将图片路径存入数据库
            pictures[i].imagePath = service.saveRealImg(fileName, pictures[i].imagePath);
            picturesPath = picturesPath + pictures[i].imagePath + ";";

            // 将压缩图片保存在/savefile/tempImages文件夹下
            File file = new File(pictures[i].imagePath);
            if (file.exists()) {
              Bitmap bm = BitmapFactory.decodeFile(pictures[i].imagePath);
              Bitmap cfsBitmap = service.confessBitmap(bm);
              service.saveMyImg(100, cfsBitmap, cfsFileName, pictures[i].imagePath);
            }

          } catch (IOException e) {
            e.printStackTrace();
          }
        }

        editNote.setTitle(editTitle);
        editNote.setPermission(editPermission);
        editNote.setWeather(editWeather);
        editNote.setText(editContent);
        editNote.setPictures(picturesPath);

        /*
         * 这里要对图片等其他信息进行保存
         */

        ModelDaoImp mdi = new ModelDaoImp(db);
        mdi.updateNote(editNote);
        Toast.makeText(getApplicationContext(), "修改记事成功", 1000).show();

        EditNoteActivity.this.finish();
        overridePendingTransition(0, R.anim.center_out);
      }
    }
  // 动态添加一张新图片
  private void addNewImage(Bitmap bitmap) {
    AlphaAnimation animation = new AlphaAnimation(0.0f, 1.0f);
    animation.setDuration(500);
    animation.setStartOffset(0);

    final FrameLayout fLayoutImg = new FrameLayout(EditNoteActivity.this);

    final ImageView img = new ImageView(EditNoteActivity.this);
    FileService fileService = new FileService(getApplicationContext());
    Bitmap cfsBitmap = fileService.confessBitmap(bitmap);
    img.setImageBitmap(cfsBitmap);
    img.setScaleType(ScaleType.CENTER_CROP);
    img.setId(pictureNum);
    fLayoutImg.addView(img);

    ImageView iv_delete = new ImageView(EditNoteActivity.this);
    iv_delete.setImageResource(R.drawable.ic_delete);

    FrameLayout.LayoutParams fParams =
        new FrameLayout.LayoutParams(
            FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT);
    fLayoutImg.addView(iv_delete, fParams);
    fLayoutImg.startAnimation(animation);
    iv_delete.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            AlphaAnimation animation_remove = new AlphaAnimation(1.0f, 0.0f);
            animation_remove.setDuration(500);
            animation_remove.setStartOffset(0);
            fLayoutImg.startAnimation(animation_remove);

            for (int i = 0; i < 4; i++) {
              if (pictures[i].num == img.getId()) {
                // 获得待删除的图片的路径及其压缩图片的路径
                File file = new File(pictures[i].imagePath);
                FileService fileService = new FileService(getApplicationContext());
                String cfsImagePath =
                    fileService.getCfsImagePath(
                        "/easyTravel/savefile/tempImages/", pictures[i].imagePath);
                File cfsFile = new File(cfsImagePath);
                // 删除原图片和压缩图片
                if (file.exists() && cfsFile.exists()) {
                  file.delete();
                  cfsFile.delete();
                }
                // 处理数组中的数据
                for (int j = i; j < 3; j++) {

                  pictures[j].imagePath = pictures[j + 1].imagePath;
                  pictures[j].num = pictures[j + 1].num;
                }
                pictures[3].imagePath = null;
                pictures[3].num = -1;
                break;
              }
            }

            pictureNum--;
            llayoutEditNewImage.removeView(fLayoutImg);
          }
        });

    LinearLayout.LayoutParams lParams = new LinearLayout.LayoutParams(150, 150);
    lParams.setMargins(0, 10, 15, 0);
    llayoutEditNewImage.addView(fLayoutImg, lParams);
  }