-2

I'm beginner in android development and i'm trying to build an app with multiple equations and i need the result to be viewed in one text and in vertical lines every result for equation viewed in line, i know how to show them together but it will show them either for the same line or in un-arranged manner like this code:

Result.setText("MDRD=" + Double.toString(m) + " MDRD.abbv" + Double.toString(b));

,, So what i have to do to show them like this????

MDRD= 9999 // any number

MDRD.abbv =8888 // any number

,, in another way :

if i have an equation and i want show the result in text, i'll use "Result.setText", also if i want to show more than one equation's result in the same text "Result", i can use "+", but what i want to show more than one equation's result in the same text "Result" but every equation's result appear in one line

mohamd jado
  • 23
  • 1
  • 1
  • 8
  • Your description of what you want to achieve is unclear. – barq Feb 06 '15 at 08:32
  • if i have an equation and want show it result in text, i'll use "Result.setText", also if i want to show more than one equation's result in the same text "Result", i can use "+", but what i want to show more than one equation's result in the same text "Result" but every equation's result appear in one line – mohamd jado Feb 06 '15 at 08:37
  • Edit your questionto improve it, please. – barq Feb 06 '15 at 08:37

2 Answers2

0

Simply use the newline character "\n", like this:

Result.setText("MDRD=" + Double.toString(m) + "\nMDRD.abbv" + Double.toString(b));
iMDroid
  • 2,108
  • 1
  • 16
  • 29
0

If I understood your question right you are trying to add a line break to textview (Result)?! This can be easily achieved by adding a newline \n to your String:

Result.setText("MDRD=" + Double.toString(m) + "\nMDRD.abbv" + Double.toString(b));
Sprigg
  • 3,340
  • 1
  • 18
  • 26