• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps split long text with horizontal swipe to turn pages

Engmex

Lurker
Hi I'm trying to create an app that allows the user to read a long text and horizontally swipe to change pages pretty much like the Kindle app. I understand that I can implement the horizontal swipe function using the viewpager and pageradapater classes, however I'm not sure how to split the long text over the different pages. At the moment I think I need to take the text and split it programatically before passing it on the the pageradapter. Would this be the best way or is there some easier way using the pageradapater class itself. Any pointers would be appreciated.
 
You'll need to create a file type that is structured to allow "page breaks." For example, in your custom file type, you might seperate pages by a <page> tag, alone on a line. In your app, you would parse the file for these page tags.
 
Hi thanks for the reply. The problem is that I won't know the page size until the app is run as different devices have different size screens and resolutions. Also I would like to allow the user to change the font type and allow text zoom. Actually I would like to be able to give the user as much controls over the text display as possible including changing the line spacing.
 
Back
Top Bottom