/** * Add a single user to the list. * * @param user The user to add */ private void addUser(UserData user) { userCnt++; LayoutInflater inflater = getLayoutInflater(); View userView = inflater.inflate(R.layout.user_profile, list, false); TextView name = (TextView) userView.findViewById(R.id.user_name); name.setText(user.getUserName()); TextView age = (TextView) userView.findViewById(R.id.user_age); age.setText(user.getAge()); TextView city = (TextView) userView.findViewById(R.id.user_city); city.setText(user.getCity()); TextView stateCountry = (TextView) userView.findViewById(R.id.user_state_country); stateCountry.setText(user.getState() + ", " + user.getCountry()); Bitmap profilePic = user.getProfilePic(); if (profilePic != null) { ImageView profile = (ImageView) userView.findViewById(R.id.user_profilepic); profile.setImageBitmap(profilePic); } String note = user.getNote(); if (note != null && note.length() > 0) { Button noteButton = (Button) userView.findViewById(R.id.btn_note); noteButton.setVisibility(View.VISIBLE); noteButton.setOnClickListener(new NoteClicker(note)); } userView.setOnClickListener(new ProfileClicker(user.getId())); userView.setTag(user); list.addView(userView); }