I have developed an Application where i am using page Curlview. I am passing array of Drawables and it creating bitmap one by one. after 20 images app crash with error outofmemory. can any one help me.? I saw different answer on stack but not working.
//curlview
    mCurlView.setBitmapProvider(new CurlView.BitmapProvider() {
        @Override
        public Bitmap getBitmap(int width, int height, int index) {
            newData.size();
            Bitmap bmp = null;
            if(index==1)
            {
                isindex0=true;
            }
            try {
                Drawable drw = newData.get(index).drawable;
              //  BitmapFactory.Options options = new BitmapFactory.Options(); options.inPurgeable = true;
                bmp = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
               bmp.eraseColor(0xFFFFFFFF);
                Canvas c = new Canvas(bmp);
                int margin = 0;
                int border = 0;
                Rect r = new Rect(margin, margin, width /*- margin*/, height/* - margin*/);
                int imageWidth = r.width() - (border * 2);
                int intrinsicWidth = drw.getIntrinsicWidth();
                int intrinsicHeight = drw.getIntrinsicHeight();
                int imageHeight = imageWidth * intrinsicHeight
                        / intrinsicWidth;
                if (imageHeight > r.height() - (border * 2)) {
                    imageHeight = r.height() - (border * 2);
                    imageWidth = imageHeight * drw.getIntrinsicWidth()
                            / drw.getIntrinsicHeight();
                }
                r.left += ((r.width() - imageWidth) / 2/*-5*/) - border;
                r.right = r.left + imageWidth + border + border;
                r.top += ((r.height() - imageHeight) / 2) - border;
                r.bottom = r.top + imageHeight + border + border;
                Paint p = new Paint();
                p.setColor(Color.WHITE);
                c.drawRect(r, p);
                r.left += border;
                r.right -= border;
                r.top += border;
                r.bottom -= border;
               // drw = resizingclass.scaleDrawable(drw, c.getWidth(), c.getHeight(), MainActivityShow.this);
                drw.setBounds(0, 0, imageWidth, imageHeight);
                drw.draw(c);
User contributions licensed under CC BY-SA 3.0