How to display images by url in a ListView

0

I am receiving data from a server. Name, profession and photo the photo gives me a url so I can open it I have the following code:

public class AdapterListPesquisaResp extends BaseAdapter {

private ImageLoader il;

    private LayoutInflater mInflater;
    private ArrayList<ItemListaPesquisaResp> itens;

    public AdapterListPesquisaResp(Context context, ArrayList<ItemListaPesquisaResp> itens) {
        //Itens que preencheram o listview
        this.itens = itens;
        //responsavel por pegar o Layout do item.
        mInflater = LayoutInflater.from(context);
    }

    public int getCount() {
        return itens.size();
    }


    public ItemListaPesquisaResp getItem(int position) {
        return itens.get(position);
    }


    public long getItemId(int position) {
        return position;
    }

    public View getView(int position, View view, ViewGroup parent) {

        ItemSuporte itemHolder;
        //se a view estiver nula (nunca criada), inflamos o layout nela.
        if (view == null) {
            //infla o layout para podermos pegar as views
            view = mInflater.inflate(R.layout.texto_resposta_pesquisa, null);

            //cria um item de suporte para não precisarmos sempre
            //inflar as mesmas informacoes
            itemHolder = new ItemSuporte();
            itemHolder.txtTitle = ((TextView) view.findViewById(R.id.txtnome_resp_pesquisa));
            itemHolder.txtTrabalho = ((TextView) view.findViewById(R.id.txttrabalho_resp_pesquisa));
            itemHolder.txtkm = ((TextView) view.findViewById(R.id.txtkm_resp_pesquisa));
            itemHolder.imgIcon = ((ImageView) view.findViewById(R.id.imagemviewfoto_resp_pesquisa));
            itemHolder.imgnota = ((ImageView) view.findViewById(R.id.imageView_nota_estrela));
         //   itemHolder.buscarimg = ((ImageView) view.findViewById(R.id.imgbuscar_pesquisa));
         //   itemHolder.buscar = ((TextView) view.findViewById(R.id.txtbuscarmais_resp_pesquisa));
            itemHolder.txtkminforma = ((TextView) view.findViewById(R.id.textView));
            itemHolder.corfundo = ((RelativeLayout)view.findViewById(R.id.layoutresposta_pesquisa));

            //define os itens na view;
            view.setTag(itemHolder);
        } else {
            //se a view já existe pega os itens.
            itemHolder = (ItemSuporte) view.getTag();
        }

        //pega os dados da lista
        //e define os valores nos itens.
        ItemListaPesquisaResp item = itens.get(position);
        if (item.toString() == "Anuncios de trabalho") {
            itemHolder.txtTitle = ((TextView) view.findViewById(R.id.txtnome_resp_pesquisa));
        } else {
                itemHolder.txtTitle.setText(item.getnome());
                itemHolder.txtTrabalho.setText(item.getprofissao());
                itemHolder.txtkm.setText(item.getkm());
                itemHolder.imgIcon      <---    PRECISO CARREGAR UMA FOTO URL
                itemHolder.imgnota.setImageDrawable(item.getnota());
            }
        return view;
    }


    private class ItemSuporte {

        ImageView imgnota, buscarimg,imgIcon;
        TextView txtTitle, txtkminforma;
        public TextView txtkm;
        public TextView txtTrabalho;
        TextView buscar;
        RelativeLayout corfundo;
    }

Note: I have a list of at least 50 items. what better way for me to load these 50 images ex:

  

link

    
asked by anonymous 18.11.2014 / 12:40

0 answers