public void onSelectFromGalleryResult(Intent data) {
    Uri selectUriImage = data.getData();

    String[] projection = {MediaColumns.DATA};

    Cursor cursor = managedQuery(selectUriImage, projection, null, null, null);

    int column_index = cursor.getColumnIndexOrThrow(MediaColumns.DATA);
    cursor.moveToFirst();

    String selectImagePath = cursor.getString(column_index);

    BitmapFactory.Options options = new BitmapFactory.Options();

    options.inJustDecodeBounds = true;
    BitmapFactory.decodeFile(selectImagePath, options);

    final int REQUIRED_SIZE = 250;

    int scale = 1;
    while (options.outWidth / scale / 2 > REQUIRED_SIZE
        && options.outHeight / scale / 2 >= REQUIRED_SIZE) {
      scale *= 2;
    }
    options.inSampleSize = scale;
    options.inJustDecodeBounds = false;
    bitmap = BitmapFactory.decodeFile(selectImagePath, options);

    circleBitmap = CircleCropBorder.getCroppedBitmap(bitmap, 120);
    imageView.setImageBitmap(circleBitmap);
  }
  private void setAllInfo() {

    byte[] img = getIntent().getByteArrayExtra(Conts.UPEXTRA_PHOTO);

    ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(img);

    bitmap = BitmapFactory.decodeStream(byteArrayInputStream);
    circleBitmap = CircleCropBorder.getCroppedBitmap(bitmap, 120);
    imageView.setImageBitmap(circleBitmap);
    etName.setText(getIntent().getStringExtra(Conts.UPEXTRA_NAME));
    etEmail.setText(getIntent().getStringExtra(Conts.UPEXTRA_EMAIL));
    etDesignation.setText(getIntent().getStringExtra(Conts.UPEXTRA_DES));
    etCity.setText(getIntent().getStringExtra(Conts.UPEXTRA_CITY));
    etNumber.setText(getIntent().getStringExtra(Conts.UPEXTRA_NUMBER));
  }
  // get image for camera
  public void onCaptureImageResult(Intent data) {
    bitmap = (Bitmap) data.getExtras().get("data");
    ByteArrayOutputStream bytes = new ByteArrayOutputStream();

    bitmap.compress(Bitmap.CompressFormat.JPEG, 90, bytes);

    File designation =
        new File(Environment.getExternalStorageDirectory(), System.currentTimeMillis() + ".jpg");

    FileOutputStream fo;

    try {
      designation.createNewFile();
      fo = new FileOutputStream(designation);
      fo.write(bytes.toByteArray());
      fo.close();
    } catch (Exception e) {
      e.printStackTrace();
    }

    circleBitmap = CircleCropBorder.getCroppedBitmap(bitmap, 120);
    imageView.setImageBitmap(circleBitmap);
  }