textview and special characters not showing correct - android

I have a text showing in the textview which is displayed correctly since years (Productive App), but now I get a nondisplayable Character as result (?)
textViewBottom.setText("Übersicht");
is showing as
?bersicht.
How can I achieve showing the special character correctly and does one know what could be changed ?

Related

Certain unicode characters unintentionally get converted to flag emoji in Android TextView

I am trying to show a text in my android app using special unicode characters (Look like letters).
One character always is correspondending to tow unicode characters:
The first one is always '\uD83C' (55356) which is follwed by '\uDDF9' (56825) for 'A' for example (56826 for 'B' etc...). Setting the text generally works fine but whenever the text contains a substring which correpondens to a country encoding (Like 'ES' for Spain) it does not show the two characters but the flag instead.
I already tried to understand this behaviour and searched for possibilites to turn i did not find any soloutions
Example:
I want to show these characters: 🇹🇪🇸🇹
String value as char array:
Result in my TextView:
Can you help me find a way to disable this behaviour. I already seen it working in other apps.
The characters you are using only exist to produce flag emoji; they serve no other purpose and are not intended to be used for “fancy” text. Displaying flags for valid region codes is their only correct behaviour.
If you absolutely have to use them without that happening, you need to insert invisible characters inbetween every letter to break up the ligatures, for example U+200C (Zero Width Non-Joiner) or U+2060 (Word Joiner).

Android display unicode characters in TextView

I am displaying data in a TextView that is being retrieved from a remote source. Sometimes that text contains characters that don't display properly in my TextView. For example, & shows as &
I tried:
text = Html.fromHtml(text).toString();
Then the characters display properly, but all of the text appears on one line, even if it doesn't fit on one line. From there I tried setting textView.setSingleLine(false); but it still shows as one line of text.
How can I get this text to show the characters properly and also show as multiple lines when necessary? Other solutions suggest manually putting the characters in a string variable, or displaying the characters programmatically, but since it's text that is pulled from the web that isn't possible.
Split your data into separate lines, call fromHtml on each and then join them back together.

How to add a line break hint in an Android app name [duplicate]

This question already has answers here:
Zero-width line breaking space for Android
(5 answers)
Closed 7 years ago.
I have an app name that consists of a single word, but it happens to be a slightly long word (14 characters). In the Launcher on my phone, this name is longer then the allocated space so Android breaks the word after the last character that still fits on the first line, which is the wrong place. How can I hint Android where it should add the line break in the app name in case it ever needs to be broken to wrap it over multiple lines?
A workaround would be to just add a space in the word so Android will wrap it there. But this would spell the word incorrect and is inconsistent with the branding of the app, which is unacceptable. The same holds for adding a hyphen on the wrapping position.
Another possible solution would be to add a soft hyphen (U+00AD) on the wrapping position, but Android doesn't seem to care for that. It always displays the hyphen (so it's not treated as soft) and it doesn't use the hyphen as the wrapping position either.
Any suggestions?
Use \n in your String or String Reference in XML. That should do the trick!

android text wrapping

In my android application, I am displaying a long string into multiple pages. I achieve this by breaking the long string into a string array where every array element holds the number of characters which can fit on one screen (without scrolling). Also by using a previous/next button at the bottom of my activity I change the content of my textview to switch between pages(array elements).
Where I am stuck is in finding out how many characters will show on one page/screen. Remember I don’t want user to scroll. I use the paint.breaktext with screenwidth as the parameter and find out how many characters go in one line and then multiply it by number of lines on one screen to get the number of characters in a page. Android’s text wrapping at the end of each line is what gets my calculation of finding characters in a page, wrong. I am trying to put my own logic to accommodate for text wrapping but that is not working.
So my question is:
Is there any way I can find out that how many characters will show in one screen?
Or what can also help me is if I find out what logic is followed by android for wrapping the text for newline. Because if I know that, then I can readjust my number of characters on a page accordingly.
Or other option could be to disable text wrapping (not sure if possible). Because then I can use my own logic to wrap the text rather than trying to figure out Android’s text wrapping logic and adjusting my character-on-a-page accordingly.
Any help is much apreciated.

How to convert special character to Image(Smiley) [duplicate]

This question already has an answer here:
Closed 11 years ago.
Possible Duplicate:
webserivce messages in listview with smileys
I created a Db and added 4 fields to it. 1. ID , 2. Position, 3. Special Character 4. URL. So I was able to display the corresponding special character when clicked. when I submit how can I convert that special character into smiley image. I tried to use functions like "Contains()" and "Replace". But nothing worked when I submitted the message to list view.
I am listing messages in list view from web service.
I get the same special character and text. I don get the image instead of special character.
How can I convert special character into smiley image. I store all the images in drawable folder.
First Thing :Using ListAdapter you can achieve this
Refer : http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/List14.html
And Second : You need to programatically decide which icon to replay with which special character.
In List Adapter you will have textview + icon.
Another method would be to use the webview. And create a html string and replace your special characters with image tags.

Categories

Resources