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; } }
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); }