G2A Many GEOs
SHARE
TWEET

Untitled

a guest Apr 10th, 2015 218 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package br.livro.android.cap14.banco;
  2.  
  3. import java.util.List;
  4.  
  5. import android.content.Context;
  6. import android.view.LayoutInflater;
  7. import android.view.View;
  8. import android.view.ViewGroup;
  9. import android.widget.BaseAdapter;
  10. import android.widget.TextView;
  11.  
  12. public class CarroListAdapter extends BaseAdapter {
  13.         private LayoutInflater inflater;
  14.         private List<Carro> lista;
  15.         public CarroListAdapter(Context context, List<Carro> lista){
  16.                 inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  17.                 this.lista = lista;
  18.         }
  19.  
  20.         @Override
  21.         public int getCount() {
  22.                 return lista.size();
  23.         }
  24.  
  25.         @Override
  26.         public Object getItem(int position) {
  27.                 return lista.get(position);
  28.         }
  29.  
  30.         @Override
  31.         public long getItemId(int position) {
  32.                 return position;
  33.         }
  34.  
  35.         @Override
  36.         public View getView(int position, View convertView, ViewGroup parent) {
  37.                 Carro c = lista.get(position);
  38.                 View view = inflater.inflate(R.layout.carro_linha_tabela, null);
  39.                 TextView nome = (TextView) view.findViewById(R.id.nome);
  40.                 nome.setText(c.nome);
  41.                 TextView placa = (TextView) view.findViewById(R.id.placa);
  42.                 placa.setText(c.placa);
  43.                 TextView ano = (TextView) view.findViewById(R.id.ano);
  44.                 ano.setText(String.valueOf(c.ano));
  45.                 return view;
  46.                
  47.                
  48.         }
  49.  
  50. }
RAW Paste Data
Ledger Nano X - The secure hardware wallet
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top