Back to project page mailinglistmoderator.
The source code is released under:
Copyright (c) 2010, Magnus Hagander All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:...
If you think the Android project mailinglistmoderator listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
/* * ListServerAdapter.java - This class holds an ArrayAdapter for the main activity. * // w w w. ja v a 2s.co m * Copyright (C) 2010 Magnus Hagander <magnus@hagander.net> * * This software is released under the BSD license. */ package net.hagander.mailinglistmoderator.glue; import java.util.Vector; import net.hagander.mailinglistmoderator.R; import net.hagander.mailinglistmoderator.backend.ListServer; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; /** * @author Magnus Hagander <magnus@hagander.net> * */ public class ListServerAdapter extends ArrayAdapter<ListServer> { private Vector<ListServer> items; public ListServerAdapter(Context context, int textViewResourceId, Vector<ListServer> servers) { super(context, textViewResourceId, servers); items = servers; } /** * Create a view that contains the information we want to show about each * list. */ @Override public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; if (v == null) { LayoutInflater vi = (LayoutInflater) getContext().getSystemService( Context.LAYOUT_INFLATER_SERVICE); v = vi.inflate(R.layout.main_item, null); } ListServer o = items.get(position); if (o != null) { TextView n = (TextView) v.findViewById(R.id.TextView_ServerName); TextView s = (TextView) v.findViewById(R.id.TextView_ServerStatus); n.setText(o.getName()); s.setText(o.getStatus()); } return v; } }