Musical note symbols on Android - android

I'm working on an a piano quiz app and I'm at the point where I need to write all the letter notes on the keyboard, more exactly when the user tries to guess what note was played and will press a key the musical letter will appear on that key.
This a screenshot of the app when the user touches a key:
My question is related to the musical symbol flat:
How can I achieve that symbol and implement it in the app? For example dflat is shown as "DB" and I need to rewrite it to "Dflat", flat as the musical symbol.
Edit: The letter notes are shown as text views.

Are you asking whether there is a text character for a flat symbol? If so, check here: http://en.wikipedia.org/wiki/List_of_Unicode_characters
Are you asking how to set the font to one that supports said character? If so, check out the setTypeface() method of TextView: http://developer.android.com/reference/android/widget/TextView.html
You might also consider using icons instead of text.
Edit: The unicode character for the flat symbol ♭ is 266D, and you can use unicode in Java via the \u escape character. Something like this:
sampleText.setText("\u266D");
You have to be using a font that supports that character. And more importantly, so do your users. That's why it might be a better idea to use an icon instead.

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).

display multiline/multiple characters as key label on soft keyboard keys

Hi i am working on android soft keyboard. Normally labels displayed on
keys are single character as shown below
the above one is done by just using keylabel attribute of Key tag in Keyboard
to display whatever text we want on the key. But now my requirement is to display multiple characters on single key as shown below
I got one solution to this by using android:keyIcon but limitation is I need the color of characters to be configurable so that a user can change color of any character. Like 1 with red, | with blue, q with green. So it must be configurable to any color.That's why I skipped keyIcon property for displaying text on character.
So is there any way to set multiple characters on key.
The standard KeyboardView provided by android framework doesn't support displaying secondary text (or multiple characters). To achieve your desired functionality you need to subclass the KeyboardView(or simply View) and implement its onDraw method and draw directly to the Canvas.
You can check the source code of latinIME KeyboardView where its been implemented using hint label.
Also you need to write your own parser for parsing the Keyboard xml. you can check here how its done in LatinIME.
Understanding the complete package Keyboard in LatinIME will be very helpful for your requirement.
Hi I have done it with by taking reference of Customize the appearance of a <Key>
By playing with given code after three days i have got my solution.

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()

Android Keyboard font change

I am creating a custom keyboard using KeyboardView class provided in API. I want to change the typeface of the label of keys. (i.e. using kiran.ttf file, 'K' will then Displayed as 'क')
I have searched a lot, but couldn't succeeded yet.
Thanks in advance.
The only real way to do this (and have it output the correct symbol to an EditText when using the keyboard) is to use UTF-8 unicodes. I'm currently developing an engineering keyboard, and I simply found all the symbols I needed, then I output the unicode using getCurrentInputConnection().commitText("\u2220", 1);
In your case, if you were looking for that character you've got in the question, it's unicode is \u0915
Adding that to my keyboard (for demonstration purposes) gives me this:
with the output in the editText near the top of the screen. The key itself is in the top left corner of the keyboard. The specific set of unicode that comes from is called "Devanagari", and the characters can be found here: http://unicode.org/charts/PDF/U0900.pdf.
Hope that helps!

HTML/ASCII Symbols in TextView?

Is there a way to represent special HTML characters in a EditText in Android? I want to display symbols like section signs (§), bullet points (•), degrees (°), etc.
Is there a way to do this?
Thanks!
EDIT: The original post had asked about a TextView, but my intended question is about EditTexts. I want the user to be able to press the button corresponding to the symbol they want, and the symbol will be added to the EditText, and they then resume typing.
Have you tried \u00A7 \u2022 and \u00B0 in setText?
That are unicode numbers of those characters.
For EditText, you just have to create buttons with mEditText.getText().append(character) and probably mEditText.focus().
Have you looked at the Html.fromHtml(...) methods?
Alternatively you could just use a WebView instead of a TextView and use loadData(...) to load an HTML string.

Categories

Resources