1

I want to set position onClick Button where I have declared in Adapter, but I don't know how to set the position in Activity.

This is My Adapter

public void onBindViewHolder(final PhotoViewHolder holder, final int position) {holder.plus.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        if (mContext instanceof PhotoPicker) {
            ((PhotoPicker) mContext).tambahFoto(position);

        }
    }
});}

I wanna call in my function in Activity like this

public void tambahFoto(int position) {


    count = Integer.parseInt(tampilan.getText().toString());

    if(count > 1) {
        jumlahFoto = jumlahFoto + 1;
        photo_cropAdapter.notifyDataSetChanged();

        count++;
        tampilan.setText(""+count);
        jum.setText(jumlahFoto+"/ "+dataProduct.getMaxQty()+" Photo");

    }

    }

But how can I set the Button's position? Can you help me?

Vanya Rachel
  • 1,329
  • 1
  • 18
  • 20

0 Answers0