Android Open Source - HRForecast-WFM Metadata List Adapter

From Project

Back to project page HRForecast-WFM.


The source code is released under:

Copyright 2014 Ahmed Shafei

If you think the Android project HRForecast-WFM 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 de.hrf.workforcemanagement.adapter;
/*  w w w  .j  a va2 s.  c  o  m*/
import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import de.hrf.workforcemanagement.R;
import de.hrf.workforcemanagement.models.Metadata;

public class MetadataListAdapter extends BaseAdapter {
  List<Metadata> list;
  Activity activity;

  public MetadataListAdapter(Activity activity, List<Metadata> list) {
    this.activity = activity;
    this.list = list;

  public int getCount() {
    return list.size();

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

  public long getItemId(int position) {
    return 0;

  private class ViewHolder {
    TextView metadataKey;
    TextView metadataValue;

  public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder;
    Metadata metadata = list.get(position);
    if (convertView == null) {
      LayoutInflater inflater = (LayoutInflater) activity
      convertView = inflater.inflate(R.layout.metadatalist_row, parent,
      holder = new ViewHolder();
      holder.metadataKey = (TextView) convertView
      holder.metadataValue = (TextView) convertView
    } else
      holder = (ViewHolder) convertView.getTag();

    return convertView;

Java Source Code List