Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Adapters;
- import java.util.ArrayList;
- import java.util.List;
- import mci.multipratic.R;
- import android.content.Context;
- import android.view.LayoutInflater;
- import android.view.View;
- import android.view.ViewGroup;
- import android.widget.*;
- public class RecipesAdapter extends BaseAdapter
- {
- private LayoutInflater inflater;
- private List<String> data;
- public RecipesAdapter(Context context, List<String> data)
- {
- this.inflater = LayoutInflater.from(context);
- this.data = data;
- }
- public int getCount()
- {
- return this.data.size();
- }
- public String getItem(int position)
- {
- return this.data.get(position);
- }
- public long getItemId(int arg0)
- {
- return 0;
- }
- public View getView(int position, View view, ViewGroup parent)
- {
- ViewHolder holder = new ViewHolder();
- if(view == null)
- {
- view = inflater.inflate(R.layout.recipe_listview, null);
- holder.checkBox = (CheckBox) view.findViewById(R.id.checkBoxListView);
- holder.editText = (EditText) view.findViewById(R.id.editTxtListView);
- view.setTag(holder);
- }else
- {
- holder = (ViewHolder) view.getTag();
- }
- holder.editText.setText(data.get(position));
- return view;
- }
- public static class ViewHolder
- {
- public CheckBox checkBox;
- public EditText editText;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement