Advertisement
Guest User

Untitled

a guest
Jun 24th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. public class AutomovelAdapter extends ArrayAdapter<Automovel>{
  2.  
  3. private final Context context;
  4. private final List<Automovel> elementos;
  5.  
  6.  
  7. public AutomovelAdapter(Context context,List<Automovel> elementos){
  8. super(context, R.layout.linha, elementos);
  9. this.context = context;
  10. this.elementos = elementos;
  11. }
  12.  
  13.  
  14.  
  15.  
  16. @Override
  17. public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
  18.  
  19. LayoutInflater inflater = (LayoutInflater) context
  20. .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  21.  
  22.  
  23. View rowView = inflater.inflate(R.layout.linha, parent, false);
  24.  
  25. TextView titulo = (TextView) rowView.findViewById(R.id.txtNome);
  26. TextView ano = (TextView) rowView.findViewById(R.id.txtAno);
  27. TextView autor = (TextView) rowView.findViewById(R.id.txtAutor);
  28.  
  29. titulo.setText(elementos.get(position).getPlaca());
  30. ano.setText(elementos.get(position).getModelo());
  31. // autor.setText("Será que foi");
  32.  
  33.  
  34.  
  35.  
  36. return rowView;
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement