Actually GRP is all over this code, not sure how to make it generic.
Also in the GetView its looking specifically for the "description" field. I guess I best make a new class like this for each set of tables.
Using javascript Syntax Highlighting
public class DatabaseAdapter extends ArrayAdapter<Grp> {
private Context mContext;
private ArrayList<Grp> mItems;
private int mXmlId;
public DatabaseAdapter(Context context, int textViewResourceId, ArrayList<Grp> items) {
super(context, textViewResourceId, items);
this.mContext = context;
this.mItems = items;
this.mXmlId = textViewResourceId;
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
View v = convertView;
if (v == null) {
LayoutInflater vi = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = vi.inflate(mXmlId, null);
}
Grp mo = mItems.get(position);
if (mo != null) {
TextView text = (TextView) v.findViewById(R.id.myTextView);
if (text != null) {
if(mo .getDescription() != null){
text .setText(mo .getDescription());
}
}
}
return v;
}
}
Parsed in 0.005 seconds, using
GeSHi 1.0.8.4