Best way to display large amount of text in an Android App - android

I'm relatively new to mobile app development - I'm kinda learning as I go. I'm creating an app that will serve multiple purposes - notifications, audio/video, etc. One of the features of the app will be to display the contents of an unpublished book (no plans to publish it either via the traditional methods available today). Essentially, I want the part of the app to do teh following:
1) Have a menu which will server as a table of contents.
2) Display the text, which will be in English and Arabic.
3) Have the english text searchable.
4) Have the ability to favorite certain sections of the text.
Just wondering what's the best way to build this? Should I convert sections of my file to html and use webview? Or should I use textview?
I'm looking for the option that gives me the most robustness in terms of functionality, and flexibility when it comes to design (i.e. background images, custom fonts, formatting).
Thanks in advance.

WebView or HTML page is not a very good approach.
You can try an approach in which your data is stored in json format in your resources-->raw folder and then parse each element of the JsonObject to populate views dynamically.(If you have server then you fetch data via HttpConnection). For start you can see here

convert your file to html file and display it using webview container...If you have your book in word format then convert it to html file in any website and then display it using webview.

Related

How should I approach being able to retrieve images and description data in my React Native App offline?

I am building an app which will contain a large number of photos (200+) and about 100 descriptions of text. I need to be able to fetch and retrieve the photos and text and display them in my app however my client wants the app to be able to run offline without having to connect to the internet. I'm assuming I will have to embed the images and text data into my app itself. But I'm still new to this and was wondering what are my approaches to this and what kind of Backend I will need. The Images are in a form of png, and the text can be given in any form (pdf, docx, csv, it doesn't matter as I can always convert it).
Sorry if I am not being to specific, I'm still new and trying to figure out how to implement the data into my app.
Thank you so much!
You can store all of your stuff in arrays - or if you’re accessing them by name, objects. Text should be strings. For images, I usually put the .pngs in a folder and in array use
[`require “(pathToImageFolder/imageName.png)”,require”(pathToImageFolder.png)”]

Converting PDF to text and reading it from android

I am currently working on an android application that will allow people to read the constitution, issue is I have only managed to get my hands on a soft copy pdf document. Ideally, I wanted an API that would allow me to fetch the document by Topic, issue or paragraph, I thought of multiple ways of getting the job done
1. Is by putting the document on the server, when user opens the app it downloads the pdf and allows them to read it(Problem with this is I won't be able to mess with the content like bold some text etc).
2. Is copying the content of the pdf into the databse and just fetching the text with a query(issue with this is I wont be able to do pagination given I put the content in one field)
Here is the link to the Constitution I needed a way in which I can load the data from the database in a way that I will be able to paginate, load a single paragraph or topic at a time. Can anyone whose been in a similar situation help me figure out the best way possible.
You don't to convert it to text, you can integrate MuPdf in your application check this answer I've found integrating pdf reader

Android, Store large amount of text (HTML) and search through them

I am making a framework in order to easily "appify" books.
This framework will need to automatically detect chapter and heading to make a table of contents. The idea is to also be able to easily search through the text and find what you are looking for.
Now what I still need to figure out is:
how to store the data in such a way that I can easily detect the chapters and heading
and still be able to search through the text.
The text that is stored needs to be formatted, so I thought I would store them as HTML or Markdown (which will be translated to HTML). I don't think it would be very searchable if the text is in HTML.
P.S. it does not have to be HTML if there are other more efficient ways to format the text.
Do you really want to do such thing on the device itself?
I can suggest you to use separate sqlite database for every book. With separate tables for table of contents, chapters, summarized keywords of chapters(for faster search) and other service info.
Also here you can find full text search example
Also I recommend you to bring your own sqlite build with your app.
Now lets talk about the main problem of yours - the book scraping.
I have no competency here, I believe this problem is the same as the web sites scraping.
Upd:
Please do not store book contents as HTML, you can store it as markdown for example, it takes less amount of storage, easier to sanitize and you can always apply your styles later

Cross Device Rich Text Formatting

We're trying to work on a feature where users can enter rich text (Bold, numbered/bulleted lists, underlines, links) for content, but this content needs to be displayed in multiple places:
On browser based websites/apps.
In native iOS/Android apps.
What's the best format to use for storing this data? We are considering storing the text as html, but is this adequate, or is there a better solution/option to storing this data and rendering it?
Can native iOS/Android apps display html content well in native apps amidst other native controls, or will this text have to be converted to a different format to render well?
Thanks!

Android Application - Multiple Pages with Static Content

I am looking to create an app that has about 50 pages of static content. I can give an example of what it would look like, so that it will be easy to understand the questions.
Imagine a Jokes app, with tens or hundreds of pages
The user can see a full list of jokes, which shows the headings in a list view
Selecting a joke subject will take them to the joke page
From there they can go 'Next' or 'Previous'
They should also be able to favorite a joke
Going to the Favorites pages, will list the favorites for them
The joke pages are static. I could add more jokes with an app update but there is no dynamic content. So I am planning to have any server side code that the app can call.
Now the questions:
In Android, can I achieve this with a single activity (for the joke display) and switch the content based on selection?
There are several to store the jokes - sqlite, separate html pages or just strings.xml. Which is better for these use cases?
If there are multiple headings within a single joke (i.e. formatting as bold for them to stand out), I need to store the formatting along with the content. So HTML looks like the option?
This may be out of scope, but I want to capture the content in a standard way so that if I build an iOS app for this, I can just worry about the UI part and use the same content. Again HTML is the option?
Thanks for looking.
Yes you can achieve this with a single activity.
This is really up to you but Android provides support for SQL Databases. You may also consider looking into content providers.
Note: I would not use strings.xml because you can't load new jokes into strings.xml. If you are getting your jokes dynamically from a website, then you really should either load your content into a database and have the app display from the database, or else just load each html page individually. The html page will be easier as you will basically just be making a browser app, but the database will certainly be faster and cleaner.
HTML is certainly an option, though this question seems a little bit vague. It really depends on how you want to get your jokes. If you want to grab them as HTML pages and just display them, then the work is done for you. If you want to parse through them and display them as an android specific app, then it will be more work but you have more control on the app side.
Yes if you want your app to work cross platform you can use HTML to standardize your view across multiple devices.

Categories

Resources