0
I have an arraylist of images that is shown in a Viewpager, so far so good, this showing all the arraylist normally.
But how do I get the Viewpager that’s in focus? That is to take the right position of the arraylist being viewed by Viewpager
private class ImagePagerAdapter extends PagerAdapter {
private ArrayList<Galeria> images;
private LayoutInflater inflater;
ImagePagerAdapter(ArrayList<Galeria> images) {
this.images = images;
inflater = getLayoutInflater();
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
container.removeView((View) object);
}
@Override
public int getCount() {
return images.size();
}
@Override
public Object instantiateItem(ViewGroup view, final int position) {
View imageLayout = inflater.inflate(R.layout.item_pager_image, view, false);
assert imageLayout != null;
ImageView imageView = (ImageView) imageLayout.findViewById(R.id.image);
final ProgressBar spinner = (ProgressBar) imageLayout.findViewById(R.id.loading);
Log.i("POSITION",""+position);
... o resto do código não importa
stupid of mine.. I was looking for this on the Adapter
– felipe.rce