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.
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);
}