Back to project page NotAnotherTodoApp.
The source code is released under:
GNU General Public License
If you think the Android project NotAnotherTodoApp 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 ca.ualberta.cs.notanothertodoapp; import java.util.List; /*www . j av a 2 s. c om*/ import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.CheckBox; import android.widget.TextView; public class TodoListAdapter extends ArrayAdapter<Todo> { /* Custom adapter to put checkbox and textview in a listview * * Code from User http://stackoverflow.com/users/788677/rakhita * edited by User http://stackoverflow.com/users/428400/glenn-bech * http://stackoverflow.com/questions/8166497/custom-adapter-for-list-view */ List<Todo> todoList; public TodoListAdapter(Context context, int textViewResourceId) { super(context, textViewResourceId); } public TodoListAdapter(Context context, int resource, List<Todo> todos) { super(context, resource, todos); } @Override public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; if (v == null) { LayoutInflater vi; vi = LayoutInflater.from(getContext()); v = vi.inflate(R.layout.todo_layout, null); } Todo p = getItem(position); if (p != null) { CheckBox checkBox = (CheckBox) v.findViewById(R.id.checkBox1); TextView textView = (TextView) v.findViewById(R.id.textView1); if (checkBox != null) { checkBox.setChecked(p.getCheck()); } if (textView != null) { textView.setText(p.getItem()); } } return v; } }