Back to project page mitlocate.
The source code is released under:
MIT License
If you think the Android project mitlocate listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package edu.mit.locate.friends; /*from w w w .j a v a 2 s . c o m*/ import java.util.ArrayList; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; import edu.mit.locate.R; public class FriendsListAdapter extends ArrayAdapter<Friend> { private static class ViewHolder { TextView txtName, txtLocation, txtAge; } public FriendsListAdapter(Context context, ArrayList<Friend> friends) { super(context, R.layout.row_friend, friends); } @Override public View getView(int position, View convertView, ViewGroup parent) { Friend friend = getItem(position); ViewHolder holder; if (convertView == null) { holder = new ViewHolder(); LayoutInflater mInflater = LayoutInflater.from(getContext()); convertView = mInflater.inflate(R.layout.row_friend, null); holder.txtName = (TextView) convertView.findViewById(R.id.friendName); holder.txtLocation = (TextView) convertView.findViewById(R.id.friendLocation); holder.txtAge = (TextView) convertView.findViewById(R.id.friendAge); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } /*Typeface lumos = Typeface.createFromAsset(convertView.getContext().getAssets(), "lumos.ttf"); Typeface quint = Typeface.createFromAsset(convertView.getContext().getAssets(), "Quintessential.ttf"); holder.txtName.setTypeface(lumos); holder.txtLocation.setTypeface(quint);*/ holder.txtName.setText(friend.getName()); holder.txtLocation.setText(friend.getLocation()); holder.txtAge.setText(friend.getAge()); return convertView; } }