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
Related
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 have a TextView in my application and a user can set any text in this TextView using HTML from the application settings. The user must be able to set the position of the parts of the text in this TextView using HTML tags. But TextView doesn't support 'table' tag or CSS. And I don't know how else to set the position. Is there some tag to set the position? Or maybe it is possible with HTML.TagHandler? If it is possible - how?
Two examples:
I want to set align="center" for one line in this TextView with HTML.
I want to separate text to two or three columns.
How can I do that?
I think what you are describing is a WYSIWYG editor like TinyMCE or CKEditor. These would allow you to align text or use tables to separate text into multiple columns.
to set align, line must have its id or class, without it maybe you can use jquery to find needed line ant align text in it.
Maybe text is splited into paragraphs, than you can find needed paragraph with jquery.
To split text to columns is not so easy, try this: How to divide text into columns, if I get text dynamically for database using Javascript and CSS?
You can try <div align="center">Your line here</div>.
Check out this article to see all the supported HTML tags
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.
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.
I want to display text such that it would be like:
TITLE 1.1
text about title 1.1
TITLE 1.2
text about title 1.2
TITLE 2.1
text about title 2.1
and so on
it would be a scrolling windows, but another problem is text could be lengthy and could span multiple lines. What do you recommend i should breakup my layout with. The length will be more then the screen height so I need scrollbars. Plus need to keep title bold.
Basically I would be printing this text from a String Array. Is it possible to display it directly from arrays or i can also work with simple strings but need to know how should i breakup my layout. like scrollview -> table layout or what?
Yes it is possible to use String Array. I'd recommed to look at ListActivity and ArrayAdapter. Here is the info to start from.