I'm trying to convert BB code to HTML in Java for an Android project. An example of the text in which the bb code is embedded looks like this:
[b]This[/b] is some [url="http://www.example.com"]example[/url] text
to display my problem.
There also might be several paragraphs [i]of[/i] text and normal URLs http://www.example.com.
What it needs to look like in the TextView:
This is some example text to display my problem.
There also might be several paragraphs of text and normal URLs http://www.example.com.
Unfortunatly I don't have any code to show you since i don't know how to go about doing this. The only thing i can come up with now is making alot of regular expressions but i´m not sure if that would be the best solution.
Eventually this will all be displayed in an Android TextView.
Any help is appreciated!
There are some java BB-code libraries out there. Check this question for information on them.
Related
I am creating an Android Tutorial Application. I am planning to use Tabs to display the java and the xml code used for that topic.
I thought of using TextView and applying the Java and XML code as text to it.
However I am failing to format the Java code, plus I am not able to add xml as text at all as it has tags which are not supported.
Below are snaps from another App and the desired output is what I am looking for.
Any help or suggestions are welcomed.
You could display your Code in your TextView with HTML and style/format it with CSS.
Try this,
Suppose you have HTML code like this
<h2>Title</h2><br>
<p>description here</p>
Then in android you can use below code
TextView tvTrial=(TextView)findViewById(R.id.tvTrial);
String html="<h2>Title</h2><br> <p>description here</p>";
tvTrial.setText(Html.fromHtml("<h2>Title</h2><br><p>Description here</p>"));
Now any thing you want to display in you view you can store it the string and set it.
I have been looking through forum posts, blogs, videos, and various other websites for the past hour trying to figure out how to display text on the screen. From what I have seen this is not very simple to do. (Maybe it is once you know how to actually do it)
I decided (with a bit of regret) to post this question here. I am sorry if this question has already been asked a million times, but I am just not understanding how to get this to work. All of the code I have tried so far has not worked.
I would just like to know how I can display text on the screen. I do not want to use my own font or anything fancy. I would just like to know the simplest way to display text on the screen.
The simplest way would be to use Slick. Here's a link to the page specifically about loading and using fonts within your LWJGL program:
Slick-Util (Part 3) - TrueType Fonts for LWJGL
I am learning java currently and I love the newbostin, he makes simple fast tutorials but to display text I'm pretty sure u need to
1: have eclipse
2: make the base of it (the main string, idk how actually)
3. The actual code to do it is println("text here")
I'm not completely sure so you should check out the newBoston he is awesome at explaining.
As a means to display information on a website developed mainly with GWT and EXT-GWT, i am using a HTMLLayoutContainer. So far, the information it is displayed correctly, but it is too harsh or rough to display this way, meaning rough, not nice to see.
So the question is : Is there any other and nicer way to display (print, draw) information with GWT?.
If so, how?
You need to work on CSS
GWT CSS Ref
I'm looking for a solution to this and I have searched the web for an answer with nothing. I need a scrolling message on my webpage that can be updated by the same website but on a different page. (e.g www.webpage.com <-- has the scrolling message on it, www.webpage.com/settings <-- has a form in which you can change/update the scrolling message)
I'm pretty sure this is achievable with Java, but my knowledge on Java is slim and all my efforts have come to a fail. I have managed to get a scrolling message on my webpage and I'm sure if I could read a text file (with the message in) then assign that to a 'var', I could make that scroll but I don't know how to do that.
If you know a completely different method of doing this I am happy to change mine.
Thanks in advance,
Tom.
I would recommend javascript instead of java, since java is not really conventional anymore and looks ugly too (and requires a special plugin).
It depends on how fast you want to update the scrolling text how you want to do this. I would say save the text to a .txt or database from settings, and then have your page get it.
You can then use php to read the value from the .txt file or database to display it on your website.
If you want it to be extremely up to date you can let javasript call a little .php file that reads the file and gives you the content.
To make your text scroll you don't really need anything other than html, like so:
<marquee behavior="scroll" direction="left">Your scrolling text goes here</marquee>
You can read more about that here: http://www.quackit.com/html/codes/scrolling_text.cfm
I searched for some answers, but came up empty, maybe I'm not wording my question correctly.
Basically I want a hyper link, except it has a java on click listener attached to it, instead of an html link. I have some paragraphs of text and certain words are highlighted, I want the user to be able to click those words and it executes a function.
Any thoughts or website tutorials? Thanks.
You should use the Linkify class to achieve what you want. Here is a full tutorial that will help you