public void populateViews() {
    final Venue venue; // Venue of the event
    final String description =
        mEvent.getDescription(); // description of the event, must be more than 50 works
    final Contact contact;

    TextView categoryText = (TextView) findViewById(R.id.categorytext);
    TextView timeText = (TextView) findViewById(R.id.timetext);
    TextView venueText = (TextView) findViewById(R.id.venuetext);
    TextView contactText = (TextView) findViewById(R.id.contacttext);
    TextView descriptionText = (TextView) findViewById(R.id.descriptiontext);
    TextView resultText = (TextView) findViewById(R.id.resulttext);
    categoryText.setText(mEvent.getCategory());

    int shour = mEvent.getStart_time().get(Calendar.HOUR_OF_DAY);
    int min = mEvent.getStart_time().get(Calendar.MINUTE);
    String smin;
    if (min == 0) smin = min + "0";
    else smin = min + "";

    String starttime;

    if (shour > 12) {
      shour = shour - 12;
      starttime = shour + ":" + smin + " PM";
    } else {
      starttime = shour + ":" + smin + " AM";
    }
    int ehour = mEvent.getEnd_time().get(Calendar.HOUR_OF_DAY);
    min = mEvent.getStart_time().get(Calendar.MINUTE);
    String emin;
    if (min == 0) emin = min + "0";
    else emin = min + "";

    String endtime;
    if (ehour > 12) {
      ehour = ehour - 12;
      endtime = ehour + ":" + emin + " PM";
    } else {
      endtime = ehour + ":" + emin + " AM";
    }
    String time = starttime + " to " + endtime;
    timeText.setText(time);
    venueText.setText(mEvent.getVenue().getLocation());
    contactText.setText(mEvent.getContact().getName());
    if (description != null && description.length() > 10) {
      descriptionText.setText(description);
    } else {
      descriptionText.setVisibility(View.GONE);
      LinearLayout temp = (LinearLayout) findViewById(R.id.descriptioncontainer);
      temp.setVisibility(View.GONE);
    }
    databaseAccess = DatabaseAccess.getInstance(this);
    databaseAccess.open();
    String result = databaseAccess.getResult(mEvent.getName());
    databaseAccess.close();

    if (result == null) resultText.setText("results not declared yet");
    else resultText.setText(result);
  }
 public int getEventDrawable() {
   String cat = mEvent.getCategory();
   switch (cat) {
     case "Quiz":
       return R.drawable.quiz;
     case "Musicals":
       return R.drawable.music;
     case "HLE":
       return R.drawable.hle;
     case "ELS":
       return R.drawable.els;
     case "Dramatics":
       return R.drawable.drama;
     case "Dance":
       return R.drawable.dance;
     case "Fine Arts":
       return R.drawable.fine_arts;
     case "Films and Media":
       return R.drawable.fmc;
     case "Informals":
       return R.drawable.informals;
     case "Pronite":
       return R.drawable.pronite;
     case "Professional show":
       return R.drawable.semipro;
     default:
       return R.drawable.antlogo;
   }
 }
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   switch (item.getItemId()) {
     case android.R.id.home:
       finish();
       break;
     case R.id.contact_menu_settings:
       new BottomSheet.Builder(this)
           .title("Options")
           .sheet(R.menu.contact_detail_menu)
           .listener(
               new DialogInterface.OnClickListener() {
                 @Override
                 public void onClick(DialogInterface dialog, int which) {
                   switch (which) {
                     case R.id.call:
                       Intent intent = new Intent(Intent.ACTION_CALL);
                       if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                         intent.setPackage("com.android.server.telecom");
                       } else {
                         intent.setPackage("com.android.phone");
                       }
                       intent.setData(Uri.parse("tel:" + mEvent.getContact().getNumber()));
                       startActivity(intent);
                       break;
                     case R.id.save:
                       Intent intent1 = new Intent(Intent.ACTION_INSERT);
                       intent1.setType(ContactsContract.Contacts.CONTENT_TYPE);
                       intent1.putExtra(
                           ContactsContract.Intents.Insert.NAME, mEvent.getContact().getName());
                       intent1.putExtra(
                           ContactsContract.Intents.Insert.PHONE, mEvent.getContact().getNumber());
                       if (intent1.resolveActivity(getPackageManager()) != null) {
                         startActivity(intent1);
                       }
                       break;
                   }
                 }
               })
           .show();
       break;
     case R.id.map_menu_settings:
       Intent intent = new Intent(this, MainActivity.class);
       intent.putExtra(MainActivity.EXTRA_ACTION, mEvent.getVenue().getLocation());
       this.startActivity(intent);
       break;
   }
   return super.onOptionsItemSelected(item);
 }
  public void setReminder(int min) {
    long startMillis = 0;
    long endMillis = 0;
    Calendar beginTime = Calendar.getInstance();
    beginTime.set(
        2015,
        mEvent.getStart_time().get(Calendar.MONTH) - 1,
        mEvent.getStart_time().get(Calendar.DATE),
        mEvent.getStart_time().get(Calendar.HOUR),
        mEvent.getStart_time().get(Calendar.MINUTE));
    startMillis = beginTime.getTimeInMillis();
    Calendar endTime = Calendar.getInstance();
    endTime.set(
        2015,
        mEvent.getEnd_time().get(Calendar.MONTH) - 1,
        mEvent.getEnd_time().get(Calendar.DATE),
        mEvent.getEnd_time().get(Calendar.HOUR),
        mEvent.getEnd_time().get(Calendar.MINUTE));
    endMillis = endTime.getTimeInMillis();

    ContentResolver cr = getContentResolver();
    ContentValues values = new ContentValues();
    values.put(CalendarContract.Events.DTSTART, startMillis);
    values.put(CalendarContract.Events.DTEND, endMillis);
    values.put(CalendarContract.Events.TITLE, mEvent.getName());
    values.put(CalendarContract.Events.DESCRIPTION, mEvent.getDescription());
    values.put(CalendarContract.Events.CALENDAR_ID, mGoogleCalendarNumber);
    values.put(CalendarContract.Events.EVENT_TIMEZONE, "Asia/Calcutta");
    Uri uri = cr.insert(CalendarContract.Events.CONTENT_URI, values);
    // get the event ID that is the last element in the Uri
    long eventID = Long.parseLong(uri.getLastPathSegment());
    cr = getContentResolver();
    values = new ContentValues();
    values.put(CalendarContract.Reminders.MINUTES, min);
    values.put(CalendarContract.Reminders.EVENT_ID, eventID);
    values.put(CalendarContract.Reminders.METHOD, CalendarContract.Reminders.METHOD_ALERT);
    uri = cr.insert(CalendarContract.Reminders.CONTENT_URI, values);
    Toast.makeText(this, "Reminder set for " + min + " minutes before event", Toast.LENGTH_SHORT)
        .show();
  }