Back to project page digitalcampus.
The source code is released under:
MIT License
If you think the Android project digitalcampus 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.llenguatges.digitalcampus.adapters; /*w ww . j av a 2s . c o m*/ import java.util.List; import android.content.Context; import android.graphics.Color; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; import com.llenguatges.digitalcampus.objects.Subject; public class StudentSubjectsAdapter extends ArrayAdapter<Subject> { private List<Subject> elements; /** * Constructor * @param context * @param data */ public StudentSubjectsAdapter(Context context, List<Subject> data) { super(context, android.R.layout.simple_list_item_1); elements = data; } /** * Get the data item associated with the specified position in the data set. * @param index * @return data */ public Subject getItem(int index){ return this.elements.get(index); } /** * Get how many items are in the data set represented by this Adapter. */ public int getCount(){ return this.elements.size(); } /** * Get a View that displays the data at the specified position in the data set. * @param position * @param converView * @param parent */ public View getView(int pos, View convertView, ViewGroup parent){ View row = convertView; if(row == null){ LayoutInflater inflater = (LayoutInflater) this.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); row = inflater.inflate(android.R.layout.simple_list_item_1, parent, false); } Subject subject = new Subject(); subject = getItem(pos); TextView tv = (TextView) row.findViewById(android.R.id.text1); tv.setText(subject.name); tv.setTextColor(Color.BLACK); return row; } }