Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package framework.halpers;
- import framework.R;
- import android.content.Context;
- import android.util.Log;
- import android.view.LayoutInflater;
- import android.view.View;
- import android.view.ViewGroup;
- import android.widget.ArrayAdapter;
- import android.widget.TextView;
- import java.util.List;
- import framework.Models.Circle;
- public class CirclesArrayAdapter extends ArrayAdapter {
- private static final String TAG = "CirclesArrayAdapter";
- private List<Circle> circles;
- private Context contextAdapter;
- public CirclesArrayAdapter(Context context, int textViewResourceId) {
- super(context, textViewResourceId);
- this.contextAdapter = context;
- }
- public CirclesArrayAdapter(Context context, List<Circle> circles, int resource) {
- super(context, resource, circles);
- this.circles = circles;
- this.contextAdapter = context;
- }
- @Override
- public View getView(int position, View convertView, ViewGroup parent) {
- View v = convertView;
- if (v == null) {
- LayoutInflater vi;
- vi = LayoutInflater.from(contextAdapter);
- v = vi.inflate(R.layout.circle, null);
- }
- Circle p = circles.get(position);
- if (p != null) {
- TextView tt = (TextView) v.findViewById(R.id.id);
- TextView tt1 = (TextView) v.findViewById(R.id.userId);
- TextView tt3 = (TextView) v.findViewById(R.id.name);
- if (tt != null) {
- Log.e(TAG, "id:" + p.id);
- tt.setText(Integer.toString(p.id));
- }
- if (tt1 != null) {
- Log.e(TAG, "user_id:" + p.user_id);
- tt1.setText(Integer.toString(p.user_id));
- }
- if (tt3 != null) {
- Log.e(TAG, "name:" + p.name);
- tt3.setText(p.name);
- }
- }
- return v;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement