Advertisement
Guest User

Untitled

a guest
Jul 7th, 2015
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. public class WorkoutAdapter extends ArrayAdapter<Casa> {
  2. protected Context context;
  3. protected LinkedList<Casa> casas;
  4.  
  5. public WorkoutAdapter(Context context, LinkedList<Casa> casas){
  6. super(context, R.layout.exercise_layout, casas);
  7. this.context = context;
  8. this.casas = casas;
  9. }
  10.  
  11. @Override
  12. public View getView(final int position, View convertView, ViewGroup parent){
  13. Vholder holder;
  14. if (convertView == null){
  15. convertView = LayoutInflater.from(context).inflate(R.layout.casa_layout, null);
  16. holder = new Vholder();
  17. holder.repts = (EditText)convertView.findViewById(R.id.etRepts);
  18. convertView.setTag(holder);
  19. }else{
  20. holder = (Vholder)convertView.getTag();
  21. }
  22. Casa current = casas.get(position);
  23.  
  24. holder.repts.addTextChangedListener(new TextWatcher() {
  25. @Override
  26. public void beforeTextChanged(CharSequence s, int start, int count, int after) {
  27.  
  28. }
  29.  
  30. @Override
  31. public void onTextChanged(CharSequence s, int start, int before, int count) {
  32.  
  33. }
  34.  
  35. @Override
  36. public void afterTextChanged(Editable s) {
  37. current.setRepts(Integer.parseInt(s.toString()));
  38. }
  39. });
  40. holder.repts.setText(current.getRepts() + "");
  41. return convertView;
  42. }
  43. static class Vholder{
  44. EditText repts;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement