PropertyAdapter.java :  » Client » bankdroid » bankdroid » start » Android Open Source

Android Open Source » Client » bankdroid 
bankdroid » bankdroid » start » PropertyAdapter.java
package bankdroid.start;

import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

/**
 * @author Gabe
 */
public class PropertyAdapter extends BaseAdapter
{
  private final Property[] properties;

  public PropertyAdapter( final Property[] properties )
  {
    this.properties = properties;

  }

  @Override
  public int getCount()
  {
    return properties.length;
  }

  @Override
  public Object getItem( final int position )
  {
    return properties[position];
  }

  @Override
  public long getItemId( final int position )
  {
    return position;

  }

  @Override
  public View getView( final int position, final View contentView, final ViewGroup parent )
  {
    View view = contentView;
    if ( view == null )
    {
      view = View.inflate(parent.getContext(), R.layout.propertyitem, null);
    }

    final Property prop = (Property) getItem(position);
    ( (TextView) view.findViewById(R.id.propertyName) ).setText(prop.getName());
    ( (TextView) view.findViewById(R.id.propertyValue) ).setText(prop.getValueString());

    return view;
  }

}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.