Printing arabic strings in android - android

In my application I need to add some string to a list and print them back. Problem is when I print them I can see the letters has inter change whithing the word.The word is in Arabic. (before 4.2 android doesnt support natively for Arabic).
What I tried was using several Arabic rendering classes such as fursi class and Arabi utility class. Nothing is helped me.
Here is the word ٣.. ما زاد على actually this part ٣.. should be the first it always goes to right as I have shown. Is there way to solve this thing. this is the one and only bug to hold the application to add to market :(

Oh, ouch! Arabic is worse than Hebrew in this aspect because Arabic has its own digits! Right!
I once had a similar problem on Windows, with symbols that weren't treated exactly as Hebrew but also not exactly as non-Hebrew. The only way I found to fix this was to split the string into two - print the problematic symbols (your 300) and then print the rest of the string.
I thought that with Unicode things has gotten better. I guess not always.
UPDATE: In a comment you said the translation of the string was 3.. . In Arabic, zero and a dot look very similar (which is why I confused a dot with a zero). Perhaps the person responsible of the input typed it wrong, not being fluent in Arabic, as well? 3.. doesn't make a lot of sense (3. does, and so does 300, but 3.. ?). Check the input, it might be wrong, and that can confuse the layout algorithm.

I can't technically understand the reason behind my action to correct above issue. However this is it . ` I reverse the word and separated letters by "+" and added to the list.It is amazing !

Related

How do you handle extra strings lines added by translators?

I recently started getting translations into 5 languages for an app I'm working on. When I got the translated strings back, there were a bunch of extra lines added around any tags like <b> or xliff:g. In cases where the text before/after the tag was not a space (e.g. it was punctuation), the extra line causes Android to show an extra space. For example, consider the following string in English:
<string name="welcome_title">Welcome to <xliff:g id="app_name">App Name</xliff:g>!</string>
Pretty simple, right? When a TextView displays this in English, it obviously shows the desired result:
Welcome to App Name!
However, two separate translators (through the Play Store translation service) have now given me back translations that look like the following, e.g. in Spanish:
<string name="welcome_title">
Bienvenido a
<xliff:g id="app_name">App Name</xliff:g>
!
</string>
which causes a TextView displaying this text to show an extra space between "App Name" and the exclamation point:
Bienvenido a App Name !
Practically, this means I have to manually inspect/edit all of the thousands of lines of translations done for me to make sure there aren't extra spaces. Not only is it extremely annoying, but in cases like Arabic, I have no clue how correct any spacing is and it's really hard to know I'm editing correctly.
Has anyone come up with a way to prevent this from happening or clean it up quickly when it does happen? I couldn't find anything on this, but it's early and maybe I haven't had enough coffee! I can't be the only one who's had to deal with this.

How to implement soft hyphen in Android w/ React Native Text

<Text>
Aufmerksamkeits{'\u00AD'}defizit
</Text>
This leads iOS to
Aufmerksamkeits-
defizit
But on Android to
Aufmerksamkeitsd
efizit
So it seems that Android ignores the given soft hyphen. How can I make this work on Android as well?
I now it is a bit late, but I spent more time on this than I am proud of. If you want to use soft hyphen use \u00AD in strings, e.g.:
<string name="einzelfahrt_name">Einzelfahrrad\u00ADkarte</string>
In order to make this working though, in your TextView, you have to add:
android:hyphenationFrequency="full"
I have the same problem and it seems that Android ignores soft hyphens.
The only workaround I could think of is, only on Android, to replace the \u00AD with \u200B. It's known as zero-width-space, and it would properly break the words where expected, although it would not show any hyphenation character. You would end up with:
Aufmerksamkeits
defizit
Not the perfect solution, but at least it will not break words at random positions.

Create a textfield which only supports copy-option

Is there a way to make a textfield (EditText, TextView) on Android which displays copyable text (no edit options)? Something like Swing's JTextField().setEditable(false) on Windows?
Edit: It seems that my question was a little bit unclear, so I'm going to give it some real-world context. I am working on a checksum calculator which lets you pick a file and prints the results of the calculation into 4 different textfields. I want the user to be able to copy those hashes from the textfield, but to disable all edit options.
I believe what you are asking is very straightforward and simple, if I am reading your question wrong, please correct me!
Are the four text fields that hold the results required to be EditText 's?
otherwise - >
Question:
How to make TextView only copyable, not editable
Answer:
Well using a TextView solves the not editable part
and if you take a look
at my android studio. I have a simple TextView with an attribute of
textIsSelectable="true"
allowing users to copy and paste!
Hope this helped!
-Stephen

Android TextView URLDecode and fromHTML not quite working

I am working with HTML and Unicode text that I'm querying from a database. I'm trying to convert it for proper display in a text view.
Here is the relevant code where I'm attempting the conversion:
ReviewView.setText(Html.fromHtml(URLDecoder.decode(cursor.getString(14), "UTF-8")).toString());
However, it's only partially working. Here is an example of the text I'm working with:
is%20in%20the%20title.%3C/p%3E%3Cstrong%3EBoiled%20Brocoli%3C/strong%3E%3Cbr%20/%3EApparently%20brocoli%20does%20not%20make%20for%20a%20good%20pesto.%20This%20tasted%20like%20brocoli%20I%20used%20to%20cook%20when%20I%20was%20eleven%20at%20home%2C%20which%20is%20to%20say%20I%20don%27t%20really%20remember%20it.%3C/p%3E
I want it to look like:
is in the title.
Boiled Broccoli
Apparently broccoli does not make for a good pesto. This tasted like broccoli I used to cook when I was eleven at home which is to say I don't really remember it.
Instead I'm getting:
is in the title.Boiled Broccoli
Apparently broccoli does not make for a good pesto. This tasted like broccoli I used to cook when I was eleven at home which is to say I don't really remember it.
Any ideas on how to properly decode this?
Thanks!
The start of the Paragraph tag is wrong. in your case,it starts with a end tag, like this < / p > (added space inside the tags for clarity). Also replace the strong tag with b. It should work now.
Separating the commands actually fixed this. So on separate lines I complete first the decode then the fromHTML.

Is there an industry standard to have the text of a button in capital or small letters for Android?

This may be a mundane question but I wanted to confirm if displaying the text of a button in capitals (like 'OK' or 'REGISTER') is acceptable or should it be in regular text (like 'Ok' or 'Register').
Thanks in advance.
P.S
I don't want to be seeminlgly shout at people using caps in buttons :)
In the Android Design site, you can see some examples of text under Writing Style which have just the first letter capitalized. "OK" is a bit of a special case though as it's an abbreviation of sorts, so I'd leave that with both letters capitalized.
The Android design guide details that and a lot more in the writing style page. Do not use all caps...
There's no standard, at least for buttons and labels it seems to be more of a "design choice". In ICS some of the text (e.g. preference and tab labels) are shown all in CAPS. Interestingly enough, there's a setting for textviews to accomplish that: android:textAllCaps. See this. If it's a block of text of course, don't do it.
Sure. You can use the Java String function toUpperCase() or toLowerCase()

Categories

Resources