[Solved] Linebreak in Android

Put your problem here if it does not fit any of the other categories.

[Solved] Linebreak in Android

Postby Jesmiatka » Wed Mar 05, 2008 9:31 am

Hi guys!

I am kinda a freak who wants to see things in nice order with everything on a new line.
Now I wanted to use break lines, (HTML
, JAVA \n) but these don't work and just get printed on your screen.

For example:
I want to make a Toast that shows the inserted username and password. I want both of these on a seperate line.

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.         Toast.makeText( Login.this,
  2.  
  3. "Username: " + username.getText() + " Password: " + password.getText(),
  4.  
  5. Toast.LENGTH_LONG).show();
Parsed in 0.030 seconds, using GeSHi 1.0.8.4


Simply adding \n doesn't work.. anyone knows how to add a break line in Android?
This also does not work in the setText of a TextView..
Jesmiatka
Senior Developer
Senior Developer
 
Posts: 164
Joined: Mon Feb 04, 2008 3:37 pm
Location: Netherlands

Top

Postby plusminus » Wed Mar 05, 2008 9:56 am

Hello Jesmiatka,

in a ProgressDialog "[font=Lucida Console]\n[/font]" works fine with me.

Just tried on a Toast and it works too :darrow: A, B and C are below each other:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. Toast.makeText(this, "A\nB\nC", Toast.LENGTH_SHORT).show();
Parsed in 0.032 seconds, using GeSHi 1.0.8.4


Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby Jesmiatka » Wed Mar 05, 2008 10:11 am

Uhrgg... it actually does.. what the hell :-P
Don't know what I tried but it works with setText aswell, close/delete topic ;-)
Jesmiatka
Senior Developer
Senior Developer
 
Posts: 164
Joined: Mon Feb 04, 2008 3:37 pm
Location: Netherlands

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Exabot [Bot], Google [Bot] and 16 guests