cats-oss/android-gpuimage

passing the selected GpuImageFilter from recycler view adapter to Activity makes it black

Hrishita opened this issue · 2 comments

I have recycler view that displays various filters on ImageView. when user clicks on recycler view item I am passing the GpuImageFilter through an interface to the activity. In activity, the implemented method of interface receives the GpuImageFilter and set it on GpuImage. The problem Is that when i click on a item of recycler view and scroll the recyclerview, the ImageVIew at that position becomes black or transparent.

Here is my code of onBindViewHolder

    final GPUImageFilter currentFilter = filtersModels.get(position);
    if(gpuImage == null)

    { 

        gpuImage = new GPUImage(context); 

    } 

    gpuImage.setFilter(currentFilter);

    holder.imageView.setImageBitmap(gpuImage.getBitmapWithFilterApplied(original));

    holder.itemView.setOnClickListener(new View.OnClickListener() {

        @Override

        public void onClick(View v) {

            mCallback.onFilterSelected((currentFilter));

        }

    });

and in the onFilterSelectedMethod this is code

     `arrayList.set(PRE_FILTER_INDEX, filter);

    filters = new GPUImageFilterGroup(arrayList);

    mainImage.setFilter(filters);`

How can i prevent the Image View in recyclerview from turning black?
Thanks

Well, I have managed to achieve this. (in kotlin) Ask me if you need a sample project.

Well, I have managed to achieve this. (in kotlin) Ask me if you need a sample project.

Hi @kasem-sm. Could you please share details about how you achieved this?