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
Related
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
I am thinking about making a keyboard (for myself and a few friends) with the sprites of the 721 Pokémon in it. First, however, I need to figure out a good way to store these characters. My idea was to store these in unused Unicode characters, but I need 721 of them.
Is there a better way to have custom emoji without overwriting existing ones? If not, what are 721 characters I can use (preferably together, no breaks in between) to store the Pokémon?
As a bonus, how can I store the shiny versions of these Pokémon?
Then, how do I draw these characters using my keyboard?
Encoding
You probably want to store them in a Private Use Area (PUA) block.
There are 3 of them, I would use one of the supplementary ones, as the risk to stumble on someone's else private use is reduced.
Don't override the existing ones.
Rendering
You will need to use your own font and embed it in your application.
You will need a way to tell the text engine "hey, for characters in this range use this font". So you need some rich text format (i.e. HTML), so use a WebView.
TextView might also work, if you use a Spanned created Html.fromHtml. But I am not sure if that supports specifying an embedded font, need to try.
Input
You would need a custom keyboard... There might be some open source, data driven one. Or one in the store that allows you to customize it. Or you can add them to the dictionary, with a shortcut, but then you will need to know all the names (so that you can type p.pikachu). Or you can use a character picker.
Storage
At this point they are strings. You can store as any other text, move through the wire, on disk, etc.
I want to have an android app where, i want to display text in some foreign language lets say urdu.. I will call a web service and will get urdu text. my question is can i set that text in textview as it is.
I have made an application in the past which can take the text from strings files for different localisation and can show the text however this is different use case, as i can not save the texts locally.
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!
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.