@Override
  public void endElement(String uri, String localName, String qName) throws SAXException {
    currentElement = false;

    /** set value */
    if (localName.equalsIgnoreCase("fromid")) {
      try {
        objUserRecommendationObject.fromid = Integer.parseInt(currentValue);
      } catch (Exception e) {
        Log.e("Error in Event Parsing objUserRecommendationObject- senderId ", e.toString());
      }
    } else if (localName.equalsIgnoreCase("fromname")) {
      try {
        objUserRecommendationObject.fromname = currentValue;
      } catch (Exception e) {
        Log.e("Error in Event Parsing - objUserRecommendationObject.strSenderName ", e.toString());
      }
    } else if (localName.equalsIgnoreCase("thread_id")) {
      try {
        objUserRecommendationObject.thread_id = currentValue;
      } catch (Exception e) {
        Log.e(
            "Error in Event Parsing - 	objUserRecommendationObject.strThreadId=currentValue; ",
            e.toString());
      }
    } else if (localName.equalsIgnoreCase("subject")) {
      try {
        objUserRecommendationObject.subject = currentValue;
      } catch (Exception e) {
        Log.e("Error in Event Parsing - objUserRecommendationObject.strSubject ", e.toString());
      }
    } else if (localName.equalsIgnoreCase("message") && messageTagCount == 2) {
      try {
        objUserRecommendationObject.message = currentValue;
        messageTagCount--;
      } catch (Exception e) {
        Log.e("Error in Event Parsing - objUserRecommendationObject.strMessage ", e.toString());
      }
    } else if (localName.equalsIgnoreCase("is_read")) {
      try {
        if (!currentValue.equals("True")) noOfNewRecommendations++;
        objUserRecommendationObject.is_read = currentValue;
      } catch (Exception e) {
        Log.e("Error in Event Parsing - objUserRecommendationObject.strIsRead", e.toString());
      }
    } else if (localName.equalsIgnoreCase("gaeventid")) {
      try {
        objUserRecommendationObject.gaeventid = currentValue;
      } catch (Exception e) {
        Log.e("Error in Event Parsing - objUserRecommendationObject.strGaEventId", e.toString());
      }
    } else if (localName.equalsIgnoreCase("gaeventname")) {
      try {
        objUserRecommendationObject.gaeventname = currentValue;
      } catch (Exception e) {
        Log.e("Error in Event Parsing - objUserRecommendationObject.strGaEventName", e.toString());
      }
    } else if (localName.equalsIgnoreCase("date_created")) {
      try {
        objUserRecommendationObject.date_created = currentValue;
      } catch (Exception e) {
        Log.e("Error in Event Parsing - objUserRecommendationObject.strDateCreated", e.toString());
      }

    } else if (localName.equalsIgnoreCase("message") && messageTagCount == 1) {
      try {
        AppConstants.vctUserRecommendations.add(objUserRecommendationObject);
        Log.i("raeched message", "here" + AppConstants.vctUserRecommendations.size());
        messageTagCount = 0;
      } catch (Exception e) {
        Log.e("Error in Event Parsing - AppConstants.vctUserRecommendations ", e.toString());
      }
    } else if (localName.equals("messages")) {
      Log.i("raeched", "here" + AppConstants.vctUserRecommendations.size());
      UserAccountBusinessLayer userAccBL = new UserAccountBusinessLayer();
      userAccBL.deleteInboxValues();
      for (int i = 0; i < AppConstants.vctUserRecommendations.size(); i++) {
        UserRecommendationObject objUserRecommendationObject =
            AppConstants.vctUserRecommendations.get(i);
        userAccBL.InsertInUserInbox(objUserRecommendationObject);
      }
    }
  }
  public void showFavouritePopup(final int eventId) {
    LayoutInflater inflater = getLayoutInflater();
    LinearLayout popup = (LinearLayout) inflater.inflate(R.layout.category_popup, null);

    Button btnCompany = (Button) popup.findViewById(R.id.btnCompany);
    Button btnEvent = (Button) popup.findViewById(R.id.btnEvent);
    EventsBusinessLayer ebl = new EventsBusinessLayer();
    final UserAccountBusinessLayer uabl = new UserAccountBusinessLayer();
    TextView dialogText = (TextView) popup.findViewById(R.id.add_favorite_text);

    if (ebl.isEventAttendedByUser(eventId, AppConstants.USER_ID)
        && uabl.isBusinessIsInUserFavorites(businessId, AppConstants.USER_ID)) {
      dialogText.setText(R.string.all_added_to_favorite);
    } else {
      dialogText.setText(R.string.add_to_favorite);
    }
    if (ebl.isEventAttendedByUser(eventId, AppConstants.USER_ID)) {
      btnEvent.setVisibility(View.GONE);
    }

    if (uabl.isBusinessIsInUserFavorites(businessId, AppConstants.USER_ID)) {
      btnCompany.setVisibility(View.GONE);
    }

    btnCompany.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            int duration = Toast.LENGTH_SHORT;
            CharSequence text = "";
            int status =
                Ga2ooJsonParsers.getInstance().addBusinessToUser(AppConstants.USER_ID, businessId);
            if (status > 0) {
              text = getResources().getString(R.string.company_added_successfully);
              Business tmpBusiness = new Business();
              tmpBusiness.businessid = businessId;
              tmpBusiness.businessname = " ";
              tmpBusiness.useraddedbusinessid = 0;
              tmpBusiness.date_updated = "0";
              uabl.InsertUserBusiness(tmpBusiness);
              Toast toast = Toast.makeText(context, text, duration);
              toast.show();
            } else if (status == 0) {
              text = getResources().getString(R.string.compamy_already_in_your_favorite);
              Toast toast = Toast.makeText(context, text, duration);
              toast.show();
            } else if (status == -1) {
              DialogUtility.showConnectionErrorDialog(MoreEventsByBusiness.this.getParent());
            }
            customDialog.dismiss();
          }
        });

    btnEvent.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            customDialog.dismiss();
            int duration = Toast.LENGTH_SHORT;
            CharSequence text = "";
            //				Ga2ooParsers objGa2ooParsers=new Ga2ooParsers();
            //				int status=objGa2ooParsers.addEventToUser(AppConstants.USER_ID,eventId);
            int status =
                Ga2ooJsonParsers.getInstance().addEventToUser(AppConstants.USER_ID, eventId);
            if (status > 0) {
              text = getResources().getString(R.string.event_successfully_added);
              eventsBL = new EventsBusinessLayer();
              eventsBL.addToAttending(eventId, AppConstants.USER_ID);
              userActBL.insertUserFavorites(AppConstants.USER_ID, eventId, status);
              Toast toast = Toast.makeText(context, text, duration);
              toast.show();
            } else if (status == 0) {
              text = getResources().getString(R.string.event_already_in_palendar);
              Toast toast = Toast.makeText(context, text, duration);
              toast.show();
            } else if (status == -1) {
              DialogUtility.showConnectionErrorDialog(MoreEventsByBusiness.this.getParent());
            }
          }
        });
    customDialog = new PopUpDailog(getParent(), popup, 220, LayoutParams.WRAP_CONTENT);
    customDialog.show();
  }