Android Open Source - Review List Adapter

From Project

Back to project page


The source code is released under:

Apache License

If you think the Android project listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package nl.fhict.intellicloud.answers;
// w w  w. jav a2s  . c  o  m
import java.util.List;

import nl.fhict.intellicloud.answers.backendcommunication.IQuestionService;
import nl.fhict.intellicloud.answers.backendcommunication.QuestionDataSource;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class ReviewListAdapter extends BaseAdapter {

  List<Answer> answerList;
  Activity activity;
  public ReviewListAdapter(Activity activity, List<Answer> answerList)
    this.activity = activity;
    this.answerList = answerList;
  public int getCount() {
    return answerList.size();

  public Object getItem(int position) {
    return answerList.get(position);

  public long getItemId(int position) {
    return position;

  public View getView(int position, View view, ViewGroup viewGroup) {
    View rowView = view;
    Answer answer = answerList.get(position);
    if(rowView == null){
      LayoutInflater inflater = activity.getLayoutInflater();
      rowView = inflater.inflate(R.layout.answer_list_item, null);
      ViewHolder viewHolder = new ViewHolder();
      viewHolder.ivUserPicture = (ImageView) rowView.findViewById(;
      viewHolder.tvRequestor = (TextView) rowView.findViewById(;
      viewHolder.tvDate = (TextView) rowView.findViewById(;
      viewHolder.tvQuestion = (TextView) rowView.findViewById(;
    ViewHolder holder = (ViewHolder) rowView.getTag();
    holder.tvRequestor.setText(answer.getAnswerer().getFirstName() + " " + answer.getAnswerer().getLastName());
    holder.tvDate.setText("HIER KOMT DATUM: 27-11-2013");
    return rowView;
  static class ViewHolder{
    public ImageView ivUserPicture;
    public TextView tvRequestor;
    public TextView tvDate;
    public TextView tvQuestion;


Java Source Code List