Source:
<code>public void resolvePatientDataDisplay(final Patient patient) { if (("M").equals(patient.getPerson().getGender())) { ((TextView) rootView.findViewById(R.id.patientDetailsGender)).setText("Male"); } else { ((TextView) rootView.findViewById(R.id.patientDetailsGender)).setText("Female"); } if (patient.getPerson().getPhoto() != null) { final Bitmap photo = patient.getPerson().getPhoto(); ImageView patientImageView = (ImageView) rootView.findViewById(R.id.patientPhoto); patientImageView.setImageBitmap(photo); patientImageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(getContext(), PatientPhotoActivity.class); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); <START> photo.compress(Bitmap.CompressFormat.PNG, 0, byteArrayOutputStream); <END> intent.putExtra("photo", byteArrayOutputStream.toByteArray()); intent.putExtra("name", patient.getPerson().getName().getNameString()); startActivity(intent); } }); } ((TextView) rootView.findViewById(R.id.patientDetailsName)).setText(patient.getPerson().getName().getNameString()); Long longTime = DateUtils.convertTime(patient.getPerson().getBirthdate()); if (longTime != null) { ((TextView) rootView.findViewById(R.id.patientDetailsBirthDate)).setText(DateUtils.convertTime(longTime)); } if (null != patient.getPerson().getAddress()) { showAddressDetailsViewElement(rootView.findViewById(R.id.addressLayout), R.id.addressDetailsStreet, patient.getPerson().getAddress().getAddressString()); showAddressDetailsViewElement(rootView.findViewById(R.id.stateLayout), R.id.addressDetailsState, patient.getPerson().getAddress().getStateProvince()); showAddressDetailsViewElement(rootView.findViewById(R.id.countryLayout), R.id.addressDetailsCountry, patient.getPerson().getAddress().getCountry()); showAddressDetailsViewElement(rootView.findViewById(R.id.postalCodeLayout), R.id.addressDetailsPostalCode, patient.getPerson().getAddress().getPostalCode()); showAddressDetailsViewElement(rootView.findViewById(R.id.cityLayout), R.id.addressDetailsCity, patient.getPerson().getAddress().getCityVillage()); } }</code><technical_language>I feel view this kind of logic in MVP pattern</technical_language>

Target:
public void resolvePatientDataDisplay(final Patient patient) { if (("M").equals(patient.getPerson().getGender())) { ((TextView) rootView.findViewById(R.id.patientDetailsGender)).setText("Male"); } else { ((TextView) rootView.findViewById(R.id.patientDetailsGender)).setText("Female"); } ImageView patientImageView = (ImageView) rootView.findViewById(R.id.patientPhoto); if (patient.getPerson().getPhoto() != null) { final Bitmap photo = patient.getPerson().getPhoto(); final String patientName = patient.getPerson().getName().getNameString(); patientImageView.setImageBitmap(photo); patientImageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { showPatientPhoto(photo, patientName); } }); } ((TextView) rootView.findViewById(R.id.patientDetailsName)).setText(patient.getPerson().getName().getNameString()); Long longTime = DateUtils.convertTime(patient.getPerson().getBirthdate()); if (longTime != null) { ((TextView) rootView.findViewById(R.id.patientDetailsBirthDate)).setText(DateUtils.convertTime(longTime)); } if (null != patient.getPerson().getAddress()) { showAddressDetailsViewElement(rootView.findViewById(R.id.addressLayout), R.id.addressDetailsStreet, patient.getPerson().getAddress().getAddressString()); showAddressDetailsViewElement(rootView.findViewById(R.id.stateLayout), R.id.addressDetailsState, patient.getPerson().getAddress().getStateProvince()); showAddressDetailsViewElement(rootView.findViewById(R.id.countryLayout), R.id.addressDetailsCountry, patient.getPerson().getAddress().getCountry()); showAddressDetailsViewElement(rootView.findViewById(R.id.postalCodeLayout), R.id.addressDetailsPostalCode, patient.getPerson().getAddress().getPostalCode()); showAddressDetailsViewElement(rootView.findViewById(R.id.cityLayout), R.id.addressDetailsCity, patient.getPerson().getAddress().getCityVillage()); } }