So, I use the harl page curl, https://github.com/harism/android_page_curl and successfully implemented it to upload images via web streams. But I can't get it to work when I go back to previous images or pages, since the images are not coming with the correct index. that is, they do not refresh properly. I canβt figure it out.
This is my implementation when I upload images to PageProvider
private class PageProvider implements CurlView.PageProvider { @Override public int getPageCount() { return data1.size()-1; } private Bitmap loadBitmap(int width, int height, final int index) throws MalformedURLException, IOException { Bitmap b = Bitmap.createBitmap(width, height,Bitmap.Config.ARGB_8888); b.eraseColor(0xFFFFFFFF); Canvas c = new Canvas(b); System.out.println("value of current page index "+mCurlView.getCurrentIndex()+" and index is "+index); System.out.println("url forward"); aq.ajax(data1.get(index+1), Bitmap.class,0, new AjaxCallback<Bitmap>() { @Override public void callback(String url, Bitmap object, AjaxStatus status) { if(object!=null) try { System.out.println("url image downloaded "+url); y=object; aq.ajax(data1.get(index).replace(".png", ".mp3"), File.class,0,new AjaxCallback<File>() { @Override public void callback(String url, File object, AjaxStatus status) { System.out.println("url sound downloaded "+url); try { if(object!=null) { FileInputStream inputStream = new FileInputStream(object); if(index>0) { mPlayer.stop(); mPlayer.reset(); } prepareMediaPlayer(inputStream.getFD()); inputStream.close(); } } catch (Exception e) {} } }); } catch (Exception e) {
I also tried to set the index using the getCurrentIndex method, which is provided inside the CurlView class, but it does not even work. Found that the index is transmitted correctly, but the bitmap images are not updated.
More clearly the problem:
When I move forward, i.e. 1st, 2nd, 3rd, 4th, 5th ... images and sounds work correctly, but when I do the reverse of the 5th, 4th, 3rd, 2nd, 1 1st is correct, but 3rd, 2nd and 1st are invalid. Why is this happening?
android android-layout page-curl android-query
Prateek May 27 '13 at 11:58 2013-05-27 11:58
source share