Skip to content

Instantly share code, notes, and snippets.

@YoungjaeKim
Created August 31, 2013 17:14
Show Gist options
  • Save YoungjaeKim/6399516 to your computer and use it in GitHub Desktop.
Save YoungjaeKim/6399516 to your computer and use it in GitHub Desktop.
아바타 레이아웃 셋업
/**
* 아바타 셋업.
*
* @param avatarLayout
* @param avatar
*/
private void setAvatar(RelativeLayout avatarLayout, Avatar avatar) {
int resourceId;
// Head
ImageView imageViewHead = (ImageView) avatarLayout.findViewById(R.id.imageViewHead);
resourceId = this.getResources().getIdentifier("h_" + avatar.head, "drawable", this.getPackageName());
imageViewHead.setImageResource(resourceId);
// Torso
ImageView imageViewTorso = (ImageView) avatarLayout.findViewById(R.id.imageViewTorso);
resourceId = this.getResources().getIdentifier("t_" + avatar.torso, "drawable", this.getPackageName());
imageViewTorso.setImageResource(resourceId);
// Leg
ImageView imageViewLeg = (ImageView) avatarLayout.findViewById(R.id.imageViewLeg);
resourceId = this.getResources().getIdentifier("l_" + avatar.leg, "drawable", this.getPackageName());
imageViewLeg.setImageResource(resourceId);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment