private void updateUiFromCurrentStatus() { // if we have no status, do nothing if (statuses == null) return; // dynamically create the UI from the status objects LinearLayout container = (LinearLayout) findViewById(R.id.statuses); container.removeAllViews(); for (int i = 0; i < statuses.size(); i++) { // here, we dynamically create the various text elements and add them to our container com.districttaco.android.Status status = statuses.get(i); TextView locationName = new TextView(this); locationName.setText(status.getLocationName()); locationName.setTextAppearance(this, R.style.StatusHeader); container.addView(locationName); TextView locationDescription = new TextView(this); locationDescription.setText(status.getLocationDescription()); locationDescription.setTextAppearance(this, R.style.StatusContent); locationDescription.setPadding(12, 0, 0, 0); container.addView(locationDescription); TextView special = new TextView(this); special.setText(R.string.special); special.setTextAppearance(this, R.style.StatusHeader); container.addView(special); TextView statusDetail = new TextView(this); statusDetail.setText(status.getStatusText()); statusDetail.setTextAppearance(this, R.style.StatusContent); statusDetail.setPadding(12, 0, 0, 0); container.addView(statusDetail); TextView infoHeader = new TextView(this); infoHeader.setText(status.getInfoHeader()); infoHeader.setTextAppearance(this, R.style.InfoHeader); infoHeader.setPadding(0, 16, 0, 0); container.addView(infoHeader); TextView infoTitle = new TextView(this); infoTitle.setText(status.getInfoTitle()); infoTitle.setTextAppearance(this, R.style.StatusHeader); container.addView(infoTitle); TextView infoBody = new TextView(this); infoBody.setText(status.getInfoBody()); infoBody.setTextAppearance(this, R.style.StatusContent); infoBody.setPadding(12, 0, 0, 0); container.addView(infoBody); } // update last fetch time if (lastFetch != null) { TextView lastUpdate = new TextView(this); SimpleDateFormat formatter = new SimpleDateFormat(getString(R.string.date_format)); lastUpdate.setText(formatter.format(lastFetch)); lastUpdate.setTextAppearance(this, R.style.Footer); container.addView(lastUpdate); } }