Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class WorkoutAdapter extends ArrayAdapter<Casa> {
- protected Context context;
- protected LinkedList<Casa> casas;
- public WorkoutAdapter(Context context, LinkedList<Casa> casas){
- super(context, R.layout.exercise_layout, casas);
- this.context = context;
- this.casas = casas;
- }
- @Override
- public View getView(final int position, View convertView, ViewGroup parent){
- Vholder holder;
- if (convertView == null){
- convertView = LayoutInflater.from(context).inflate(R.layout.casa_layout, null);
- holder = new Vholder();
- holder.repts = (EditText)convertView.findViewById(R.id.etRepts);
- convertView.setTag(holder);
- }else{
- holder = (Vholder)convertView.getTag();
- }
- Casa current = casas.get(position);
- holder.repts.addTextChangedListener(new TextWatcher() {
- @Override
- public void beforeTextChanged(CharSequence s, int start, int count, int after) {
- }
- @Override
- public void onTextChanged(CharSequence s, int start, int before, int count) {
- }
- @Override
- public void afterTextChanged(Editable s) {
- current.setRepts(Integer.parseInt(s.toString()));
- }
- });
- holder.repts.setText(current.getRepts() + "");
- return convertView;
- }
- static class Vholder{
- EditText repts;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement