Android Open Source - android Todo Array Adapter






From Project

Back to project page android.

License

The source code is released under:

Copyright (c) 2013 ApiBootstraper Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Sof...

If you think the Android project android 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

/**
 * /*from   w w w . j a  v  a  2  s . c om*/
 */
package com.apibootstraper.mobile.view;

import java.util.List;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import com.apibootstraper.core.Todo;
import com.apibootstraper.mobile.R;

/**
 * @author nicolas
 *
 */
public class TodoArrayAdapter extends ArrayAdapter<Todo> {

    private final List<Todo> list;
    private final Activity context;

    /**
     * 
     */
    public TodoArrayAdapter(Activity context, List<Todo> list) {

        super(context, R.layout.todo_list_item, list);
        this.context = context;
        this.list = list;
    }

    static class ViewHolder {
        protected TextView text;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        View view = null;
        if (convertView == null) {

            LayoutInflater inflator = context.getLayoutInflater();
            view = inflator.inflate(R.layout.todo_list_item, null);
            final ViewHolder viewHolder = new ViewHolder();
            viewHolder.text = (TextView) view.findViewById(R.id.todo_list_item_name);
            view.setTag(viewHolder);
        }
        else {
            view = convertView;
        }

        ViewHolder holder = (ViewHolder) view.getTag();

        Todo entity = (Todo) list.get(position);
        holder.text.setText(entity.getName());
        return view;
    }

}




Java Source Code List

com.apibootstraper.core.Entity.java
com.apibootstraper.core.Todo.java
com.apibootstraper.core.User.java
com.apibootstraper.mobile.TodoApplication.java
com.apibootstraper.mobile.activity.MainActivity.java
com.apibootstraper.mobile.activity.TodoActivity.java
com.apibootstraper.mobile.activity.TodoFormActivity.java
com.apibootstraper.mobile.http.EntityManager.java
com.apibootstraper.mobile.http.HTTPClient.java
com.apibootstraper.mobile.http.HTTPResponse.java
com.apibootstraper.mobile.http.JsonHttpResponseHandler.java
com.apibootstraper.mobile.repository.TodoRepository.java
com.apibootstraper.mobile.repository.UserRepository.java
com.apibootstraper.mobile.util.AppConfig.java
com.apibootstraper.mobile.util.DateUtils.java
com.apibootstraper.mobile.view.TodoArrayAdapter.java