Я пытаюсь изменить элементы массива строк, используя if if в адаптере пейджера, но когда я запускаю свое приложение, это дает исключение.Выдает эту ошибку The application's PagerAdapter changed the adapter's contents without calling PagerAdapter#notifyDataSetChanged! Expected adapter item count.
Это мой код
@Override
public Object instantiateItem(ViewGroup container, int position)
{
if (getIntent().getStringExtra("love")!=null)
{
icons=getResources().getStringArray(R.array.love);
}
else if (getIntent().getStringExtra("sad")!=null)
{
icons=getResources().getStringArray(R.array.sad);
}
Context context=Love.this;
mLayoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View itemView = mLayoutInflater.inflate(R.layout.imagew, container, false);
ImageView imageView = itemView.findViewById(R.id.imageview);
random = new Random();
prevInts = new ArrayList<>();
Picasso.get().load(icons[randomUniqueInteger()]).placeholder(R.drawable.loading).error(R.drawable.loading).into(imageView);
container.addView(itemView);
return itemView;
}