Back to project page RobolectricSample.
The source code is released under:
MIT License
If you think the Android project RobolectricSample listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.pivotallabs; // w w w . ja v a 2s . com 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 java.util.ArrayList; class NamesAdapter extends BaseAdapter { private ArrayList<String> names; public NamesAdapter(ArrayList<String> names) { this.names = names; } @Override public int getCount() { return names.size(); } @Override public Object getItem(int position) { return names.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { TextView textView = convertView == null ? createView(parent) : (TextView) convertView; textView.setText(names.get(position)); return textView; } private TextView createView(ViewGroup parent) { LayoutInflater layoutInflater = (LayoutInflater) parent.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); return (TextView) layoutInflater.inflate(R.layout.name_row, parent, false); } }