Cross Device Rich Text Formatting - android

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!

Related

What is the best way to create text based Android apps?

I am working on an Android app which will store long texts, images etc. A 'guide' app in other words. But I am not sure which one would be the best way(or the most logical way) to do this. Storing the texts in strings.xml, using HTML&CSS and showing it using WebView, using databases, or something else?
That depends a bit on where the text is coming from, IMHO.
If the text is baked into the app, and it will only change via an update to the app itself, I'd use HTML/CSS and store it in assets/. They can then be loaded using loadUrl("file:///android_asset/...") in a WebView. If you wanted full-text search, you could prepare a SQLite database with an FTS table and package that with the app as well, unpacking and using it on the first run of the app.
If you plan on downloading the text, then the decision hinges more on what the server is serving, as you're probably stuck with that format. That, in turn, would influence the storage approach.
String resources (strings.xml) are fairly clunky for long bits of text.

How do applications store and display attributed text (similar to HTML)

I was wondering how do applications store and display attributed text. By attributed text I mean text that can have photos, colors, style(bold italic etc) and so on.
is there a universal way through which one can store attributed text and display it everywhere (ios/android/web/desktop etc) ?
the only way I found after a lot of research was to store your text in HTML format and then using some kind of webview to render the html back. But is there another way to do this ?
an example of such app: the notes app on mac os

Android: creating email with relative content

I'm trying to create email with tables, divs and other components. When I'm using Html.fromHtml(body) it doesn't convert tags to proper structure. Divs with float:left; are not in the same line, table dissapear.
How Can I create a relative content? Is it possible?
There are many different email client apps for Android.
None have to support HTML at all.
Most that support rich formatting use the subset of capabilities offered by EditText. That does not include "tables, divs and other components". Attempts to provide those sorts of things, or CSS, or JavaScript, or whatever, will be stripped out via Html.fromHtml().
Some email clients may use a WebView with a rich editor. It is possible that this editor will handle "tables, divs and other components". But, many rich editors on the Web do not, or at least do not support arbitrary starting HTML.
Your choices are:
Use HTML that is likely to degrade gracefully, given the wide range of HTML support in email clients, or
Do not use ACTION_SEND to send the email (e.g., upload the message to your Web server, which sends the email)

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

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.

alternative format to PDF format for Android development

I am developing an Android application which only works with text documents. Currently I'm using PDF format. But the total size of all the documents leads to some 25-30mb, too much for an app.
The app is required to open the text documents and also allow features like zoom, search, etc. For this we considered a PDF viewing library, but that is simply increasing the size of the app.
We have considered redirecting the PDF's to open in default apps in the phones. But there are some text documents that NEED to be viewed through our own app. But a PDF viewing library isnt the best solution due to already huge size.
my question is : is there any alternative format to PDF format to be used in Android application that allows file compressibility without loss of quality?
and does not require a third party library to open the text documents.
Also , will I be able to zoom in on the text?
is there any alternative format to PDF format to be used in Android application that allows file compressibility without loss of quality?
HTML.
does not require a third party library to open the text documents
The WebView widget in Android can render HTML.
will I be able to zoom in on the text?
You as a developer can control the zoom level of the WebView, and users may also be able to use pinch-to-zoom gestures, depending on your content and the WebView size.

Categories

Resources