how to resolve UnsupportedOperationException Required method destroyItem was not overridden
Don't call the super. Remove
super.destroyItem(container, position, object);
An extract of the PagerAdapter source code
123 public void More ...destroyItem(ViewGroup container, int position, Object object) {
124 destroyItem((View) container, position, object);
125 }
191 public void More ...destroyItem(View container, int position, Object object) {
192 throw new UnsupportedOperationException("Required method destroyItem was not overridden");
193 }
Just override:
@Override
public void destroyItem(View container, int position, Object object) {
((ViewPager) container).removeView((View) object);
}
When you override destroyItem, you should remove the object got in the parameter from its container(also got in parameters). You can cast it to the corresponding View type. Here it is:
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
container.removeView((LinearLayout)object);
}