Glide and GPUImageView issue

323 Views Asked by At

I am trying to implement an Android image filter library called GPUImage Located here.

I have tried to use it like below

public static GPUImageView img_bg;
 img_bg = (GPUImageView) findViewById(R.id.img_bg);
 categoryAdapter1.setOnClickLIstner(new OnClickLIstner() {
                        @Override
                        public void onClick(View v, Image image, int pos) {
                            Glide.with(NameArt.this)
                                    .load(image.getDrawableId())
                                    .centerCrop()
                                    .dontAnimate()
                                    .into(img_bg);
                            img_bg.setVisibility(View.VISIBLE);
                        }
                    });

But I am getting error like below

cannot resolve method 'into' (jp.co.cyberagent.android.gpuimage.GPUImageView)

I am unable to solve it because I am learning android and java yet. Let me know if any expert here can help me for solve the issue. Thanks

2

There are 2 best solutions below

0
Marcin Orlowski On

Ensure you are using right version of Glide your GPUImageView can deal with. Recent v4 brings API changes that are not backward compatible and since this lib you are using looks bit rusty and does not set properly dependencies, you got the clash. Enforce v3 of Glide, or drop dated library.

0
AskNilesh On

try this to load image in your GPUImage

 new DownloadImage(img_bg).execute(url);

create a Async Task

public class DownloadImage extends AsyncTask<String, Void, Bitmap> {
GPUImageView  bmImage;

public DownloadImage(GPUImageView  bmImage) {
    this.bmImage = (GPUImageView  ) bmImage;
}

protected Bitmap doInBackground(String... urls) {
    String urldisplay = urls[0];
    Bitmap mIcon11 = null;
    try {
        InputStream in = new java.net.URL(urldisplay).openStream();
        mIcon11 = BitmapFactory.decodeStream(in);
    } catch (Exception e) {
        Log.d("Error", e.getStackTrace().toString());

    }
    return mIcon11;
}

protected void onPostExecute(Bitmap result) {
    bmImage.setImageBitmap(result);
}
}

i hope that it will work in your case