I'm trying to make a chat app in android, I wanna add emotions in my app..
I used unicode in android 4.4.2 and it worked fine..
But when I try to use it in android 2.3.7 it doesn't work.. So how can i use emoticons in android 2.3.7 and in android 2.3.7 there is emoticons panel in Messaging (Insert Smiley) does that use unicode ? And if it uses it how can I get characters unicode ? I googled for it but found nothing.
I want it to be like this in my code :
array.add(new Emoticon(unicode, ":D")): // Emoticon class is a custom class with constructor (String unicode, String Shortcut)
Thanks :)
If you want to implement in your app emoticons keyboard you can use in this great library:
https://github.com/ankushsachdeva/emojicon
This shows a popup window with emojicons over the soft keyboard.
in this library you can find EmojiconHandler class and there you can see this code that generate the emoticons:
sEmojisMap.put(0x1f604, R.drawable.emoji_1f604);
sEmojisMap.put(0x1f603, R.drawable.emoji_1f603);
sEmojisMap.put(0x1f600, R.drawable.emoji_1f600);
sEmojisMap.put(0x1f60a, R.drawable.emoji_1f60a);
sEmojisMap.put(0x263a, R.drawable.emoji_263a);
sEmojisMap.put(0x1f609, R.drawable.emoji_1f609);....
more of that , in this site :
http://www.fileformat.info/info/unicode/char/search.htm
you can convert emoticons from UTF-16 to java source code like this example:
UTF-16 ---> 0x1f604 in java source code equls to ---> "\uD83D\uDE03"
Related
I have been trying to call a Java method in unity. Not working for me, even the simplest example from the docs
using System.Collections;
using UnityEngine;
public class ExampleClass : MonoBehaviour {
void Start () {
AndroidJavaObject jo = new AndroidJavaObject ("java.lang.String", "some string");
int hash = jo.Call<int> ("hashCode");
Debug.Log ("hash=" + hash);
}
}
Unity console prints hash=0, which is not the hash code for provided String. Even if I change and use java.lang.StringInvalidClass as class name, unity still reports same result to the console without notifying errors. I can even try to call toString, toStringa, toInvalid2 and they always return empty string without showing errors.
This is a brand new 2d project with only script displayed above, attached to camara object. I am using Ubuntu, Unity 2019.4 and project platform is Android.
Thanks for the assistance.
Answering myself after some time working with unity.
All examples in the web and unity documentation doesn't mention it, which is weird since it is something simple to mention and about confusions: code needs to run as an android application. Editor or even unity remote does not work, in order to use AndroidJavaObject and related classes, your code needs to run as an android application installed in the phone.
I developed a web service using java which request from the database Arabic data.
I'm using this web service in android using volley.
The problem is when i get the data and set it in text field it's show some weird symbols (اÙÙÙسÙ).
The collation in database is : Arabic_CI_AS
I tried many solutions but nothing works!
I would really appreciate your help
This might be related to text direction attribute for the TextView, you have to set it to "anyRtl". Not sure which version that you are working on but this is available since 17+.
This above attribute can be set in one of the following ways:
From XML: Add this line: android:textDirection="anyRtl" to your
TextView tag.
From code:
textview.setTextDirection(View.TEXT_DIRECTION_ANY_RTL);
Haven't tried it though, hope this helps.
Few Links:
https://android.stackexchange.com/questions/25359/how-to-make-an-android-device-to-display-complex-rendering-of-indic-characters
Display Arabic text in android textview
https://developer.android.com/reference/android/text/TextDirectionHeuristics
I'm using the Java botbuilder to build a microsoft teams bot. I want to add Cards to my bot (e.g. to embed links, quick replies, and images).
In the above link it says: suggested actions are not supported in Microsoft Teams: if you want buttons to appear on a Teams bot message, use a card.
However, I can find no documentation on how to add a 'card' to the Activity schema.
I tried:
1. Using suggested actions
I tried adding my List<CardAction> to the SuggestedActions
field in Activity but they were not rendered by microsoft teams
(as expected, the documentation says this is not supported).
2. Using Attachments
I suspect it could be done using attachments, but can only find
documentation for the C#/JS versions (e.g.
https://learn.microsoft.com/en-us/azure/bot-service/nodejs/bot-builder-nodejs-send-rich-cards?view=azure-bot-service-3.0).
So I want to know how to add 'a card' to Activity schema so it can be rendered by my bot.
The BotFramework Java SDK is still in preview, so there isn't a lot of documentation I can point you towards. However, here is an example of adding a HeroCard to a reply.
Activity reply = new Activity()
.withType(ActivityTypes.MESSAGE)
.withRecipient(activity.from())
.withFrom(activity.recipient())
.withAttachments(Arrays.asList(
new Attachment()
.withContentType("application/vnd.microsoft.card.hero")
.withContent(new HeroCard()
.withTitle("Hero Card")
.withSubtitle("BotFramework")
.withButtons(Arrays.asList(new CardAction()
.withValue("https://learn.microsoft.com/en-us/azure/bot-service/")
.withTitle("Get started")
.withType(ActionTypes.OPEN_URL)
))
.withImages(Collections.singletonList(new CardImage()
.withUrl("https://sec.ch9.ms/ch9/7ff5/e07cfef0-aa3b-40bb-9baa-7c9ef8ff7ff5/buildreactionbotframework_960.jpg"))))
));
You can also take a look at the SDK Attachment Tests for more examples.
Hope this helps!
When I was printing java code in Eclipse, the way of printing was WYSIWYG. So if I folded some selected sections (for example import section, but also any other foldable section), it was printed as folded.
In Android Studio code is printed allways fully unfolded. Does anybody know some way (plugin or some preferences setting etc.), how to set it to print also in the folding WYSIWYG style?
My problem is that I have done the printing part in android device when the printer is already configured on the device.
If the printer is not configured on the device, the exception occurs can you tell that how u know that printer is configured on device
e1=(EditText) findViewById(R.id.editText);
String name=e1.getText().toString();
PrintManager printManager=(PrintManager) this.getSystemService(Context.PRINT_SERVICE);
//PrintDocumentAdapter printAdapter = view.createPrintDocumentAdapter();
//Toast.makeText(getApplicationContext(),"hi nikhil"+name+""+printManager.getPrintJobs(),Toast.LENGTH_LONG).show();
String text=this.getString(R.string.app_name)+"Document";
// printManager.getPrintJobs();
printManager.print(text, new MyPrintDocumentAdapter(this), null);
Log.d("print", "print" + printManager);
on Android-Studio 4.0, I noticed that you can select the parts of a file you wish to print, and in the print dialog box, it will allow you to just print the selection. This isn't exactly what you're looking for, but it is a way to bypass the long lines of import statements and comments at the head of a file.
Hello everyone ,
I am developing an application which required implementation of emoticons ( smiley). I can replace specific strings with drawable but it would be very time consuming. Is there any we to use system built in emoticons or some library to shorten my work? What I want is when I send text like this :) , the receiver get emoticon. Or when I send an emoticon he will get the same. Getting android system emoticons can help me too much.Your help would be great favor for me. Thanks
Emoji is a list of unicode emoticons which has a github that can implement emoticons into code (Found here).
From there you could use regex(\ue415\ue056\ue057) to find them or build them by char array (below).
Example:
StringBuilder sb = new StringBuilder();
for (char curr : str.toCharArray()) {
sb.append((SUPPORTED_EMOJI_SET.contains(curr)) ? convertCharToImgTag(curr) : curr);
}
where SUPPORTED_EMOJI_SET is just a set of chars, for example:
new HashSet<Character>() {{
add('\ue415');
add('\ue056');
...
}}
For more ideas: go here!