Getting repeated program stages in the adapter

Hi, I have tried to add program stages activity in the Android skeleton app, it was working well until I added a program stages in the server. When I updated metadata, I found three program stages are repeating all the time. In the attached image, after blue rectangle area, first and last three stages are in repetition. Thank you for helping me out.

.getPaged(20).observe(this, programStagePagedList -> {
programStagePagedList.isEmpty() ? View.VISIBLE : View.GONE);

Note, In debugger, I found five program stages in the contigouspagedlist.
One more thing, it seems that five stages loaded first, then after a fraction of second, the repeated items loaded in the list.

Hi @RahmanMonjur,
that piece of code seems fine to me, but maybe the adapter or another class makes it behave like that. Could we take a look at the whole class? Is it public?

Thanks @vgarciabnz. I guess so, however, not finding any anomaly in the adapter. The behaviour is weird and clueless. Yes, I forked it and here are the codes

Just a plus @vgarciabnz, if I revoke the permission of BCG stage, everything behaves fine. I mean no repeating stages then.

Although it’s not a solution, I got a temp fix to work on. onBindViewHolder event I changed…

ProgramStage programStage = getItem(position);
if (pstagelist.indexOf(programStage.uid()) < 0) {
Integer programStageInstancesCount = Sdk.d2().eventModule().events()

        if (programStageInstancesCount > 1)
            holder.subtitle1.setText(programStageInstancesCount.toString() + " instances");
            holder.subtitle1.setText(programStageInstancesCount.toString() + " instance");

        holder.cardSimple.setOnClickListener(view -> programStageSelectionListener
                .onProgramStageSelected(programUid, programStage.uid(), trackedEntityInstanceUid));
    } else {