Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7895231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:35:35+00:00 2026-06-03T07:35:35+00:00

We are displaying an epub file on the screen through our application. The file

  • 0

We are displaying an epub file on the screen through our application. The file is saved in SDCard and the following logic we are using for getting the file data from SDCard and displaying in Screen. But its taking long time to load the content in screen. Any issues with my code? please help me friends.

 File rootDir = Environment.getExternalStorageDirectory();
   EpubReader epubReader = new EpubReader();
   try {
        book = epubReader.readEpub(new FileInputStream("/sdcard/forbook.epub"));
        Toast.makeText(getApplicationContext(), "Book : " + book, Toast.LENGTH_LONG).show();
    } catch (FileNotFoundException e) {
        Toast.makeText(getApplicationContext(), "File Not Found" + book, Toast.LENGTH_LONG).show();
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        Toast.makeText(getApplicationContext(), "IO Found" + book, Toast.LENGTH_LONG).show();
        e.printStackTrace();
    }
   Spine spine = book.getSpine(); 
   List<SpineReference> spineList = spine.getSpineReferences() ;
   int count = spineList.size();
   StringBuilder string = new StringBuilder();
   String linez = null;
    for (int i = 0; count > i; i++) {
       Resource res = spine.getResource(i);

       try {
           InputStream is = res.getInputStream();
           BufferedReader reader = new BufferedReader(new InputStreamReader(is));
           try {
               String line;
            while ((line = reader.readLine()) != null) {
                   linez =   string.append(line + "\n").toString();
                    //linez=line.toString();
               }

           } catch (IOException e) {e.printStackTrace();}

           //do something with stream
       } catch (IOException e) {
           e.printStackTrace();
       }

   }
  final String mimeType = "text/html";
  final String encoding = "UTF-8";
  webView.loadDataWithBaseURL("", linez, mimeType, encoding,null);

}

Please help me friends.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T07:35:36+00:00Added an answer on June 3, 2026 at 7:35 am

    An ePub is essentially nothing more than a zip file with a number of HTML files inside. Often, there will be one file (resource) per chapter / section of the book.

    What you’re doing right now is looping through the spine of the book, loading all the resources when you can probably display 1 at most on the screen at a time.

    I’d suggest only loading the resource you want to show, which should speed up the loading time dramatically.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For displaying data in our application I've use GridView with the following markup: <asp:GridView
When displaying images on our website, we check if the file exists with a
I have problem with displaying error message in spring Application.i am using Spring MVC
I displaying multiple p:datatable 's through ui:repeat , the following code snippet illustrates what
When displaying all articles of a specific month (given through the urls like this
I am displaying 10 or so markers on google maps using gmaps4rails. When the
I have a UITableView displaying a set of options from which the user will
I originally started out displaying a web page in the assets folder using a
I'm displaying a set of images as an overlay using Google Maps. Displaying these
I am displaying my data in both the stackedBarChart and dataTable format in the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.