Back to project page Briscola.
The source code is released under:
GNU General Public License
If you think the Android project Briscola 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 com.gmail.craptik.briscola; /*w w w. jav a2 s . c om*/ import java.util.ArrayList; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.TextView; public class PlayerAdapter extends BaseAdapter { private Context context; private ArrayList<Player> players; private boolean showScore; public PlayerAdapter(Context context, ArrayList<Player> players, boolean showScore) { this.context = context; this.players = players; this.showScore = showScore; } @Override public int getCount() { return players.size(); } @Override public Object getItem(int position) { return players.get(position); } @Override public long getItemId(int position) { return 0; } @Override public View getView(int position, View view, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View rowView = inflater.inflate(R.layout.row_player, parent, false); TextView nameView = (TextView) rowView.findViewById(R.id.row_player_name); TextView pointsView = (TextView) rowView.findViewById(R.id.row_player_points); nameView.setText(players.get(position).getName()); if (showScore) { pointsView.setText(String.valueOf(players.get(position).getTotalScore())); } return rowView; } }