@Override
  public void onClick(View v) {

    int id = v.getId();
    if (id == R.id.buttonFloat) {
      linearLayoutAddPres.setVisibility(View.VISIBLE);
      buttonAddPrescription.setVisibility(View.GONE);
      linearLayoutEmpty.setVisibility(View.GONE);
      layoutAddPhotos.setVisibility(View.GONE);
      textViewNote.setVisibility(View.GONE);
    } else if (id == R.id.buttonUPloadPrescription) {
      // dialog.show();
      selectImage();
    } else if (id == R.id.buttonSendPrescription) {
      objPrescriptionModel.setDoctorAdd(editTextDoctorAdd.getText().toString());
      objPrescriptionModel.setImagePrescription(encodedImage);
      deleteExistingDirectory();
    } else if (id == R.id.buttonNext) {
      linearLayoutAddPres.setVisibility(View.GONE);
      textViewNote.setVisibility(View.VISIBLE);
      layoutAddPhotos.setVisibility(View.VISIBLE);
    }
  }
  private void init(View view) {

    objPrescriptionModel = new PrescriptionModel();

    buttonAddPrescription = (ButtonFloat) view.findViewById(R.id.buttonFloat);
    buttonUploadPrescription = (Button) view.findViewById(R.id.buttonUPloadPrescription);

    //	prescriptionDoc = (ImageView)view.findViewById(R.id.imageViewUploadPrescription);
    linearLayoutAddPres = (LinearLayout) view.findViewById(R.id.linearLayoutAdd);
    // listViewPres = (ListView)view.findViewById(R.id.listViewData);
    editTextDoctorAdd = (AutoCompleteTextView) view.findViewById(R.id.editTextDoctorAdd);
    buttonSend = (Button) view.findViewById(R.id.buttonSendPrescription);
    linearLayoutEmpty = (LinearLayout) view.findViewById(R.id.emptyView);
    layoutAddPhotos = (LinearLayout) view.findViewById(R.id.linearLayoutUploadPhotos);

    radioGroupOffer = (RadioGroup) view.findViewById(R.id.radioGroupOffer);
    radioButtonFifteen = (RadioButton) view.findViewById(R.id.homdeDeleiveryThree);
    radioButtonThirty = (RadioButton) view.findViewById(R.id.homdeDeleiveryeight);
    textViewNote = (TextView) view.findViewById(R.id.textViewNote);
    buttonNext = (Button) view.findViewById(R.id.buttonNext);
    textViewUploadedPrescrition = (TextView) view.findViewById(R.id.textViewUploadedPrescription);

    // Let's get the root layout and add our ImageView
    layout = (LinearLayout) view.findViewById(R.id.root);
    objHorizontalScrollView = (HorizontalScrollView) view.findViewById(R.id.horizontalScrollView1);
    // imageViewClose = (ImageView)view.findViewById(R.id.imageViewClose);

    listOfImagesPath = null;
    listOfImagesPath = RetriveCapturedImagePath();

    if (listOfImagesPath != null && listOfImagesPath.size() != 0) {

      /*			Log.d("list", "size in creaetView"+listOfImagesPath.size());

      //gridImages.setAdapter(new CustomGridImage(getActivity(),listOfImagesPath));

      for(int i=0;i<listOfImagesPath.size();i++){

      	ImageView image = new ImageView(getActivity());

      	// Now the layout parameters, these are a little tricky at first
      	FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
      			300,
      			400);

      	FrameLayout framelayout = new FrameLayout(getActivity());
      	framelayout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,
      			LayoutParams.MATCH_PARENT));


      	ImageView imageView = new ImageView(getActivity());
      	imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
      	imageView.setImageResource(R.drawable.ic_account_search_grey600_36dp);
      	imageView.setRight(1);

      	image.setScaleType
      	(ImageView.ScaleType.FIT_XY);
      	image.setPadding(10, 0, 10, 0);

      	try {
      		fs = new FileInputStream(new File(listOfImagesPath.get(i).toString()));

      		if(fs!=null) {
      			bm=BitmapFactory.decodeFileDescriptor(fs.getFD(), null, bfOptions);
      			image.setImageBitmap(bm);
      			image.setId(i);
      		}
      	} catch (IOException e) {
      		e.printStackTrace();
      	} finally{
      		if(fs!=null) {
      			try {
      				fs.close();
      			} catch (IOException e) {
      				e.printStackTrace();
      			}
      		}
      	}

      	framelayout.addView(image);
      	framelayout.addView(imageView);

      	layout.addView(framelayout, 0, params);
      	buttonUploadPrescription.setText("Add another prescription");
      }
       */
    } else {

      textViewUploadedPrescrition.setText("No Prescription Uploded Yet!!!");

      buttonSend.setEnabled(false);
    }

    buttonAddPrescription.setOnClickListener(this);
    buttonSend.setOnClickListener(this);
    buttonUploadPrescription.setOnClickListener(this);
    buttonNext.setOnClickListener(this);

    radioGroupOffer.setOnCheckedChangeListener(this);

    textViewNote.setText(
        Html.fromHtml("Ensure the prescription image captures the doctors details clearly"));
    textViewNote.setMovementMethod(LinkMovementMethod.getInstance());

    SessionManager session = new SessionManager(getActivity());
    User user = session.getUserDetails();

    String address = user.getAddress();
    editTextDoctorAdd.setText(address);

    bfOptions = new BitmapFactory.Options();
    bfOptions.inDither = false; // Disable Dithering mode
    bfOptions.inPurgeable =
        true; // Tell to gc that whether it needs free memory, the Bitmap can be cleared
    bfOptions.inInputShareable =
        true; // Which kind of reference will be used to recover the Bitmap data after being clear,
    // when it will be used in the future
    bfOptions.inTempStorage = new byte[32 * 1024];
  }