android epub library, skyepub

◇◆丶佛笑我妖孽 提交于 2019-12-04 11:03:37

You just need to unzip your epub book at your base directory (in your case its /book/filename). You have to unzip the epub file in books folder as epub file name.

You can see the full demo to below link

http://www.skytree21.com/cgi-bin/download.php?os=android&version=3.9.8&type=core_sample

in Demo,in LocalService class you'll get code for unzip file. In this demo they have downloaded epub file from web and after downloading first it is moved to download folder in phone directory and then its get extracted to base directory books in phone directory and then skyepub SDK will directly take its path by setting setBaseDirectory.

Here is the code for unzip file after moving asset file to download folder to phone directory

public void unzipBook(String fileName) {

        String targetDir = new String(getFilesDir().getAbsolutePath() + "/books/" + fileName);
        targetDir = SkyUtility.removeExtention(targetDir);

        String filePath = new String(getFilesDir().getAbsolutePath() + "/downloads");
        Unzip unzip = new Unzip(fileName, filePath, targetDir);
        unzip.addObserver(new UnzipHandler());
        unzip.unzip();      
    }
    class UnzipHandler implements Observer {
        @Override
        public void update(Observable observable, Object data) {
            //Unzip completed
            (new Handler()).postDelayed(new Runnable() {
                public void run() {

                }
            },500);     
        }       
    }

In your case you just need to take your asset reference and unzip it.You'll get success.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!