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; /*from w w w.java2 s . 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.R; import com.llenguatges.digitalcampus.objects.SubjectMatter; public class SyllabusAdapter extends ArrayAdapter<SubjectMatter> { private List<SubjectMatter> data; /** * Constructor * @param _context * @param _syllabusArray */ public SyllabusAdapter(Context _context, List<SubjectMatter> _syllabusArray) { super(_context, android.R.layout.simple_list_item_1); data = _syllabusArray; } /** * Get the data item associated with the specified position in the data set. * @param index * @return data */ public SubjectMatter getItem(int index) { return this.data.get(index); } /** * Get how many items are in the data set represented by this Adapter. */ public int getCount() { return this.data.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 position, View convertView, ViewGroup parent) { View row = convertView; if (row == null) { LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); row = inflater.inflate(R.layout.syllabus_layout, parent, false); } SubjectMatter syllabus = new SubjectMatter(); syllabus = getItem(position); TextView name = (TextView) row.findViewById(R.id.syllabusName); String subMtt = syllabus.position + ". " + syllabus.name; name.setText(subMtt); name.setTextColor(Color.BLACK); return row; } }