public static String getEmailForUser(String user) { if (UserData.getLogin().equalsIgnoreCase(user)) return UserData.getEmail(); for (UgUser u : UgApplication.getInstance().getUsers()) { if (u.getUserName().equalsIgnoreCase(user)) return u.getEmail(); } return ""; }
@Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = LayoutInflater.from(parent.getContext()); ViewHolder holder; if (convertView == null) { convertView = inflater.inflate(R.layout.user_list_item, null, false); holder = new ViewHolder(); holder.icon = (ImageView) convertView.findViewById(R.id.userIcon); holder.name = (TextView) convertView.findViewById(R.id.userName); holder.email = (TextView) convertView.findViewById(R.id.userEmail); holder.position = position; convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } UgUser user = data.get(position); holder.name.setText(user.getDisplayName()); holder.email.setText(user.getEmail()); ImageLoader.getInstance() .displayImage( UrlBuilder.generateAvatarUrl(user.getUserName(), user.getAvatarId()), holder.icon); return convertView; }