Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class AutomovelAdapter extends ArrayAdapter<Automovel>{
- private final Context context;
- private final List<Automovel> elementos;
- public AutomovelAdapter(Context context,List<Automovel> elementos){
- super(context, R.layout.linha, elementos);
- this.context = context;
- this.elementos = elementos;
- }
- @Override
- public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
- LayoutInflater inflater = (LayoutInflater) context
- .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- View rowView = inflater.inflate(R.layout.linha, parent, false);
- TextView titulo = (TextView) rowView.findViewById(R.id.txtNome);
- TextView ano = (TextView) rowView.findViewById(R.id.txtAno);
- TextView autor = (TextView) rowView.findViewById(R.id.txtAutor);
- titulo.setText(elementos.get(position).getPlaca());
- ano.setText(elementos.get(position).getModelo());
- // autor.setText("Será que foi");
- return rowView;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement