Need to add it to textview, for example, standard java-code.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
What do you exactly mean? You may want to change
TypefaceofTextViewtomonospace, this will make your TextView look similar to code block here at stackoverflow.This font is monospaceCode to make it look like this:
or in Java:
Edit:
So, you need some Java code formatting library, the best would be if it returned result in HTML code, so it could be easily put into
TextView.I don’t know if there is something like this for free, but here are few resources you may be interested in:
How to pretty print XML from Java?
Stand-alone Java code formatter/beautifier/pretty printer?
Edit2:
You may also use one of these JavaScript libraries:
http://alexgorbatchev.com/SyntaxHighlighter/
http://code.google.com/p/google-code-prettify/
along with custom
WebViewto show pretty formatted code.