Please help me. I'm following the example ViewPagerActivity from sample PhotoView of Chris Banes (https://github.com/chrisbanes/PhotoView) and I want to change the drawable with Picasso URL images. So, I'm trying to put multiple images in HackyViewPager via Picasso String array of urls.
my xml ViewPager:
<my.package.HackyViewPager
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="200dp" />
in onCreate:
...
ViewPager viewPager = (HackyViewPager) findViewById(R.id.view_pager);
viewPager.setAdapter(new SamplePagerAdapter());
I have a String array of URL's obtained from one single String stringDefinitionGemstonesPhoto
String[] strAry = stringDefinitionGemstonesPhoto.split(",");
and the final code in SamplePageAdapter is:
static class SamplePagerAdapter extends PagerAdapter {
private String stringDefinitionGemstonesPhoto = ("https://geology.com/minerals/photos/calcite-marble-127.jpg, https://geology.com/minerals/photos/calcite-concrete.jpg");
private String[] strAry = stringDefinitionGemstonesPhoto.split(",");
@Override
public int getCount() {
return strAry.length;
}
@Override
public View instantiateItem(ViewGroup container, int position) {
PhotoView photoView = new PhotoView(container.getContext());
System.out.println(strAry[position]);
Picasso.get().load(strAry[position]).into(photoView);
container.addView(photoView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
return photoView;
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
container.removeView((View) object);
}
@Override
public boolean isViewFromObject(View view, Object object) {
return view == object;
}
}
Only one image is showing, when I'm sliding the next photo is empty/blank. In the Log system print out the links which are splitted correctly. What is wrong?