Turkish characters don't appear in Android - android

I have this xml :
<TextView
android:id="#+id/tv_mytv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
And I have this Java :
TextView mytv;
mytv= (TextView) findViewById(R.id.tv_mytv);
mytv.setText(Html.fromHtml("<p>ğüşçı</p>"));
When I run the emulator, All I get is question marks in diamond shaped icons. How can I make my app display Turkish characters? Thanks.

Check that the charset is set to UTF-8/16 or ISO-8859-9 (Turkish charset). If that doesn't solve the problem, it could be the font itself. Try running the app on a real device to see if it works.
EDIT -
You can also try unicode charecters. For example - http://unicode-table.com/

Related

Some Font Characters Doesn't Seem Properly On Android?

For Android and IOS platforms same font used. It's looking good on IOS, but android doesn't show some characters like "Ş", "Ğ" properly.The below screenshot from android.
Seems it's not font specific problem beacuse on IOS working well.
<TextView
android:id="#+id/txt_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:fontFamily="#font/avenirltstd_book"
android:text="Şikayet Grafiği"
android:textColor="#color/white"
android:textSize="#dimen/dp18" />
Is there any special way to show these characters with same font? Or the solution is to stop dealing with this and use different font ?
check this post for setting special characters in xml file and this if you want to set using java language

fontFeatureSettings=smcp doesn't work in Android

I need to show SmallCaps text in TextView. I am trying to use code below:
<TextView
android:id="#+id/text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFeatureSettings="smcp"
android:textColor="#color/black"
android:textSize="16sp"
android:text="TEXT" />
But it just shows me normal text, without SmallCaps effect. I also try to set it programmatically (text1.fontFeatureSettings = "smcp") but also without success.
How to make SmallCaps text in Android? Why fontFeatureSettings doesn't work?
In order for this feature to work you have to have a font that actually has Small Caps characters - thus to make it work pass the font with Small Caps via app:fontFamily(android:fontFamily) for example Aller Display, and then use android:fontFeatureSettings="smcp" to make it Small Caps.
Hope it helps
Edit
as #Cliabhach pointed in comments, in code it will look something like
text1.typeface = resources.getFont(R.font.Aller_Display)
text1.fontFeatureSettings = "smcp"
Edit2
Keep in mind
For those who do not know - Small Caps will only work on lowercase characters
As you are using TextView so I guess you set value to it at runtime like says you have some String object which will get set to the TextView like:
textView.setText(someStringObj);
So you can easily set it as in lower case on it by adding:
textView.setText(someStringObj.toLowerCase());

Android O Text Justification Hebrew

I know there has been A LOT of talk here regarding justifying text in Android. But Android O just came out and a new feature came out with it, Text Justification. They say use the final JUSTIFICATION_MODE_INTER_WORD included with the TextView class. Along with setJustificationMode(). it does work when I use it with the English language, but it fails to work when I use it with the Hebrew language. I have it set up to:
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:justificationMode="inter_word"
android:text="#string/ahahvaRabba"
android:textDirection="rtl"
/>
I also tried to put android:gravity="right" but that didnt work either.
I cant imagine that google didn't think of using it with other languages.

Android TextView autoLink web Bug

I have a TextView like this.
<TextView
android:id="#+id/text_auto_linkify"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autoLink="web"
android:text="#string/link_text_auto" />
and the #string/link_text_auto" like this
<string name="link_text_auto"><b>text_auto_linkify: Various kinds
of data that will be auto-linked.</b>\n
1. In this text are some things that are actionable.\n
1.In this text are some things that are actionable.
</string>
notice the text, that the first one has space after "1."
and the result is out of my expectation.
[1.In this text are some things that are actionable.] Android thinks it's a hyperlink.
so is there anyone can tell me,why?
my phone is Moto X
and the android version is 5.1.1

Hyphen breaks the line into multi line

In a a custom list view, I have a textview showing name and emailId. When the name provided is something like A-TestThisString(testA#test.com), the length of displayed area exceeds,
In that case the string is broken at the place of hyphen like
A-
is shown in the list. This is causing lots of problems. I have found one link which talks about solution bellow
topic: "Android: How do i make nonbreakable block in TextView?"
but, I am not able to understand how to use it. Please suggest.
Thanks for your help. I found the answer. use the inputType as email or singleLine=True, it starts working fine.
I used android:inputType="date", no line breaks and hyphen is displayed nicely
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
android:text="2-3 4-5"
android:inputType="date"
android:textSize="25sp" />

Categories

Resources