1

I have downloaded the source code from github. It works fine. I want to implement this type of application, but my problem is here in the class PageProvider it has:

private int[] mBitmapIds = { R.drawable.obama, R.drawable.road_rage,R.drawable.taipei_101, R.drawable.world }

If I am adding some more images in this array from my drawable folder, those images are not shown when I am running this code.

Tried to add more images for page curl effect. And tell me what I am doing wrong.

Jeetu
  • 686
  • 2
  • 10
  • 20
  • don't see no pageprovider nowhere – njzk2 Oct 22 '12 at 11:57
  • 2
    I think there is a method called getCount, you should return correct size of this array. – Tom Oct 22 '12 at 11:58
  • oh thanks for reply ! yes tom there is getCount method and it return 5. i m also replace it with 10 but it is not show my images. it repeated previous 5 images again – Jeetu Oct 22 '12 at 12:10
  • @Jeetu Could you provide the code you modified and where you are displaying the images. That might help. – Joseph Oct 22 '12 at 12:28
  • mr. joseph pls download the code from [github](https://github.com/harism/android_page_curl) – Jeetu Oct 22 '12 at 12:38

1 Answers1

2

You have to replace:

    @Override
    public int getPageCount() {
        return 5;
    }

with:

    @Override
    public int getPageCount() {
        return mBitmapIds.length;
    }

Then, modify the calls to "loadBitmap" method (within the "updatePage" method) replacing the last parameter (it has a fixed number) with the "index" variable. Furthermore, you can get rid of the whole switch and configure the pages like you wish (just extract the code from the switch-case you want).

UPDATE1

Use this method:

    @Override
    public void updatePage(CurlPage page, int width, int height, int index) {
        Bitmap front = loadBitmap(width, height, index);
        page.setTexture(front, CurlPage.SIDE_BOTH);
        page.setColor(Color.argb(127, 255, 255, 255), CurlPage.SIDE_BACK);
    }
jihonrado
  • 409
  • 2
  • 11