while scrolling Images gets rotate in imageview in recycleview

20 views Asked by At

enter image description hereloading 200 images from url in array and showing in recyclerview but while scrolling the rendered images gets rotate , it get tilt in the imageview. I have used Glide, Asynctask to load image.

For trial purpose I have showth 0th index image to check but still the image gets titl [enter image description here][2]

in Adapter Used Async Task new DownloadImage(holder.imageView).execute(APIClient.baseUrl + "/" + item.getRestImg());

also tried glide Glide.with(mContext).load(APIClient.baseUrl + "/" + item.getRestImg()).fitCenter().thumbnail(Glide.with(mContext).load(R.drawable.animationbg)).into(holder.imageView);

used this too holder.imageView.setRotation(0);

AsyncTask Class

private class DownloadImage extends AsyncTask<String, Void, Bitmap> {
    ImageView imageView;

    public DownloadImage(ImageView imageView) {
        this.imageView = imageView;
    }

    @Override
    protected void onPreExecute() {
        super.onPreExecute();
    }

    @Override
    protected Bitmap doInBackground(String... URL) {

        String imageURL = URL[0];

        Bitmap bitmap = null;
        try {
            InputStream input = new java.net.URL(imageURL).openStream();
            bitmap = BitmapFactory.decodeStream(input);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return bitmap;
    }

    @Override
    protected void onPostExecute(Bitmap result) {
        imageView.setImageBitmap(result);
    }
}
0

There are 0 answers