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.
Related
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).
I am working on an Android app for tourists where I show a list of all rooms in my city for accomodation. I have approximately 500 lines of text, about 5 lines for each room (adress, phone number, contact person, email adress and stars rating). I want to put all that text in one activity so you can scroll and read that text.
Should I use TextView or something else? Should I save that whole text in res/strings.xml?
There is no problem with using TextViewsjust do not forgot about using ScrollView for your layout so you can scroll your TextViews.
You could use a WebView and display the text in HTML format.
I did it for big documents and used the assets folder to store and load the document.
Internationalization can be kept using following technique:
What's the best practice to deploy localized documents in Android app?
I'm working on porting an app from iOS to Android. The app is just a blog app. I would like to have the list view show just the first 7 characters from the description tag of the XML, and then when clicked, show the webpage from the XML link tag. Any suggestions for extracting the first 7 characters and using THAT for the list view title?
You can set the max text length on your TextView to 7 characters. You can set this in the xml with android:maxLength or in java with setInputFilter
I am working on a chat application with smileys. I have a image button that shows a pop up of smileys in grid view when clicked. I can select any smiley in that and it will get displayed in Edit Text.
My problem is : Now i have smiley image and text in my edittext. when i click on send i need to display this message with smiley in listview. Is it possible to display images with text in listview where i get mesages from webservice.
List view is used here as a place to display messages from web service. How can i work further in this.
Please guide me in this issue.
Regards,
Raghav Rajagopalan
Is it possible to display images with text in listview where i get mesages from webservice.
Yes it is possible of course. If you are using some complex way to get the messages from the webservice into the adapter, you must integrate this with sending these to the adapter.
Is it possible to send images to webservice and fetch them back in my listview. I am using .Net web service. I return XML from web service as my response.
Don not do that. Put your smileys in drawable or download them only once. Use your own tags inside text for smileys. For example when string :) occurs put a smiley.
I created a Db and added 4 fields to it: ID , Position, Special Character, URL. So i was able to display the corresponding specialcharcter when clicked. When i submit how can i convert that specialcharcter into smiley image. I tried to use functions like "Contains()" and "Replace". But nothing worked when i submited the message to listview. I get the same specialcharcter and text. I don get the image instead of specialcharcter. Please guide me
I suppose you are inserting the message inside a textView. You can use to replace the occurances of the special character with "<img src=\"the source\" />"
Use this to get the image shown setText(Html.fromHtml("hi how are you <img src=\"yourimage.png\" />"));
To replace :) with <img src=\"yourimage.png\" />.. use yourString.replaceAll(":)","<img src=\"yourimage.png\" />");
I am developing a chat application(like Simple Gtalk) for android mobiles. I am facing few issues in display emoji's/emoticons.
I need to replace the special character to a emojis image. How can i do this?
I select Image from grid.
Display corresponding special character of image selected into Edit Text along with message i typed.
When i click on send button i need to display emojis/ emotions instead of special character in the above list view where i display all the messages i receive from .NET web service. These images(emojis) are stored in drawable folder.
I get these messages from web service. But I want to know how can I find and replace the special character with a emojis image along with my text message coming from web service.
I need to replace the special character to a emojis image
You can refer to Emoji Picker.
Display corresponding special character of image selected into Edit Text along with message i typed.
This has already been answered on SO
But i want to know how can i find and replace the special character with a emojis image along with my text message coming from web service.
Check the Unicode chart.