How to consume data online in an Adapter

0

With this Adapter code below I created a gallery that works without problem, but instead of drawing the Drawable images I want you to consume the images that are on the web. Does anyone know how I can get this result?

public class GaleriaImagensAdapter extends PagerAdapter {

private Context context;
private int[] imagens = new int[] { R.drawable.min_interface_13, R.drawable.min_interface_14, R.drawable.min_interface_132 };

GaleriaImagensAdapter(Context context) {
    this.context = context;
}

@Override
public int getCount() {
    return imagens.length;
}

@Override
public boolean isViewFromObject(View view, Object object) {
    return view.equals(object);
}

@Override
public void destroyItem(ViewGroup pager, int position, Object object) {
    ((ViewPager) pager).removeView((ImageView) object);
}

@Override
public Object instantiateItem(ViewGroup pager, int position) {
    ImageView imagem = new ImageView(context);
    imagem.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
    imagem.setImageResource(imagens[position]);
    ((ViewPager) pager).addView(imagem, 0);
    return imagem;
}
    
asked by anonymous 14.04.2017 / 15:59

0 answers