Control change of position of a recyclerview through a progressBar

0

I'm trying to do a routine, where I control my item passing from my recyclerView to progressBar , that is, every time I change items, this change has to reflect on progress. The problem is that I can only get position when I click, I can not get through the item passing. Follow the code below: Code Adapter:

private ProgressBar progressBar;
public interface ProgressBar{void Progress(int questao);}
public void ProgressBarListener(ProgressBar progressBar){this.progressBar=progressBar;}

public class MyViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {

    public MyViewHolder(View itemView) {
        super(itemView);
        itemView.setOnClickListener(this);

    }
    @Override
    public void onClick(View v) {
        //Tentativa de pegar a mudança de questão da recycler
        progressBar.Progress(getAdapterPosition());
    }
}

Activity Code:

 //Tentativa de pegar a mudança de questão da recycler
    adapter.ProgressBarListener(new Question2Adapter.ProgressBar() {
        @Override
        public void Progress(int questao) {
            textBar.setText(questao+1+"");
            Log.w("postion",questao+1+"");
            progressBar.setProgress(questao+1);
        }
    });

Screenshot:

    
asked by anonymous 10.01.2017 / 18:48

0 answers