Android Open Source - easydb My List Adapter






From Project

Back to project page easydb.

License

The source code is released under:

Apache License

If you think the Android project easydb 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 com.san.api.easydb.example;
//from w ww. j  a v a 2  s . c  om
import java.util.List;

import com.san.api.easydb.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class MyListAdapter extends ArrayAdapter<MyEntityClass> {
  private Context        context;
  private List<MyEntityClass>  values;

  public MyListAdapter(Context context, List<MyEntityClass> values) {
    super(context, R.layout.list_item, values);
    this.context = context;
    this.values = values;
  }
  
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    View rowView = null;

    if (convertView == null)
      rowView = inflater.inflate(R.layout.list_item, parent, false);
    else
      rowView = convertView;
    
    MyEntityClass dataObject=values.get(position);
    
    ((TextView)rowView.findViewById(R.id.textTitle)).setText(dataObject.getTitle());
    ((TextView)rowView.findViewById(R.id.textSubTitle)).setText(dataObject.getSubTitle());
    ((TextView)rowView.findViewById(R.id.textTag)).setText(dataObject.getTag());
    
    return rowView;
  }
}




Java Source Code List

com.san.api.easydb.ConnectionManager.java
com.san.api.easydb.EntityProcessor.java
com.san.api.easydb.Entity.java
com.san.api.easydb.SQLHelper.java
com.san.api.easydb.Session.java
com.san.api.easydb.example.MyEntityClass.java
com.san.api.easydb.example.MyListAdapter.java
com.san.api.easydb.example.TestActivity.java