How can I apply formatting to some specific text in SQLite? - android

I am developing a small app. I used internal SQLite java class to store data. Data is successfully stored and displaying. I used card-view and recyclerview. All things are working fine. But I want to apply formatting on specif text, which is stored in sqlite. For example some text display as heading , bold etc . Actually text is to large. So i want text display as stylish. I hope you understand my question. Sorry for bad English.
Screen Shoot

You can user basic HTML and turn it into a spanned using SpannableString.fromHtml. then set that Spannable String in a text view and will will show as a stylized html.

Related

How to display a lot of text lines

I am working on an Android app for tourists where I show a list of all rooms in my city for accomodation. I have approximately 500 lines of text, about 5 lines for each room (adress, phone number, contact person, email adress and stars rating). I want to put all that text in one activity so you can scroll and read that text.
Should I use TextView or something else? Should I save that whole text in res/strings.xml?
There is no problem with using TextViewsjust do not forgot about using ScrollView for your layout so you can scroll your TextViews.
You could use a WebView and display the text in HTML format.
I did it for big documents and used the assets folder to store and load the document.
Internationalization can be kept using following technique:
What's the best practice to deploy localized documents in Android app?

Is there a way to store and display HTML with CSS to achieve text formatting in Android?

I'm creating a note taking app for Android and i would like the user to be able to format their text, i.e. bold, different text sizes.
What I would like to know is how can I do this bearing in mind the text will have to be store-able in a database.
Can i use a web view with a string of HTML i pull from the database and a custom defined CSS to style it on the user end?
I also know there is some sort of formatting class in Android but im unsure of how it work, im not convinced it would be easy to store the formatting information.
I think you should use Spannable text. See android.text.*. I think you should store the text in HTML markup. Also take a look at
http://developer.android.com/guide/faq/commontasks.html#selectingtext

Show html image and table in textview

I am using a simple textview to show some html string in my android app. If I show only text with links I have no problem, but when I receive some data which contains images and tables the images are showing like obj string only and the tablet are not even shown, only the text part is showing. I know I can use webview, but i don't have so much control of the contents view and I can't customize it so much as in textview.
Is there any way that I can show tables and images in textview, while the images are saved on sd card. I don't need any methods to download them from internet and stuff like that.
Any help / suggestions / advices are appreciated!
No. TextView is not WebView. Use the latter for more markup that elementary attributes like <B>, <U> or tags like <A>

Android app: Html formatting "[]" when importing text from database

When I in my android application import text from my database it returns text with a square symbol. The text in the database is pasted from a webpage so I belive it is som html formatting, [ENTER] etc.
Is it possible to make the textview understand the formatting and use it as it is intended to look in a webbrowser. I am not interested in changing the view if it can be avoided, just to make the textstring use the formatting to make \nl etc.
Any one know how it can be done.
Before setting the text in the TextView you can use the Html.fromHtml method on the text, this will format the text appropriately.

How to display large amounts of text on Android

I want to display about one or two full screens worth of text in an Android application (like a welcome screen or help screen), and I'm trying to figure out the best way of storing that text in the app. The text does not need formatting, but line breaks and empty lines must be preserved.
So far I have come up with the following alternatives:
Store the text in a long string in an XML file in res/values, access it like any other string and display it in a TextView. But then what is the proper way of handling line breaks, etc?
Store it in a text file in res/raw, read that from the application and display it in a TextView. Again, do I need to consider line breaks, etc, in this case?
Store it in an HTML file and display it in a WebView. Then how and where should I store the HTML file?
And there are likely more ways that I haven't thought of yet.
Is there a common way of achieving this? I would greatly appreciate sample code as well!
IMHO the most effective way would be setting up one or more strings within the strings.xml and using the \n escape sequence to force a linebreak whenever needed.
If you want to display your data directly as a WebView you should consider storing it within res/html.
But storing an extra text file within res/raw and reading it every time you want to access it doesn't seem very efficient.

Categories

Resources