---
title: "How to Print Multiple Statements to One TextView"  
description: "How to Print Multiple Statements to One TextView"  
author: "Jayden Bell"  
published: 2013-05-30  
updated: 2013-05-30  
canonical: https://www.mindstick.com/forum/942/how-to-print-multiple-statements-to-one-textview  
category: "android"  
tags: ["android"]  
reading_time: 2 minutes  

---

# How to Print Multiple Statements to One TextView

Hi Everyone!\
I have the following [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii):\
for(int i = 1; i <= doubleLength; i++) { doubleRate = (doubleBalance * (doubleRate/100))/12; doubleBalance = doubleBalance + doubleRate; doublePayment = (doubleBalance/doubleCount);\
[TextView](https://www.mindstick.com/forum/23237/how-do-i-center-text-horizontally-and-vertically-in-a-textview-in-android) [results](https://yourviews.mindstick.com/story/4497/usage-of-baking-soda-magical-results) = (TextView) findViewById(R.id.showResult); results.setText(doublePayment+"");\
doubleCount = doubleCount - 1; doubleBalance -= doublePayment;}\
What I'm [trying](https://answers.mindstick.com/qa/93698/6-mistakes-couples-are-trying-to-save-money) to do is [print](https://www.mindstick.com/blog/301752/types-of-3d-printing-technology) out every single [value](https://www.mindstick.com/articles/23219/an-optimized-description-adds-value-to-experience-and-in-turn-effectively-guest-posting-packages) of the "doublePayment" value to a TextView UI Object on the screen. However, when the [for loop](https://www.mindstick.com/forum/12568/android-for-loop-not-working-in-main-thread) finishes, it only \
prints out one value, instead of several.\
I'm porting this over from [C++](https://www.mindstick.com/blog/745/array-in-c-plus-plus), so I'm used to simply using [count](https://www.mindstick.com/forum/157774/selecting-count-with-distinct) to print to the terminal.\
Thanks in [advance](https://www.mindstick.com/blog/33258/jee-mains-and-jee-advance-exams)!\

## Replies

### Reply by AVADHESH PATEL

Hi Jayden!\
Try this, maybe you made a mistake to Print Multiple Statements to One TextView\
results.setText(doublePayment+"");You're re setting the text value instead of appending the whole String. A better approach would be using a StringBuilder:\

```
StringBuilder sb = new StringBuilder();for(int i = 1; i <= doubleLength; i++) {    doubleRate = (doubleBalance * (doubleRate/100))/12;    doubleBalance = doubleBalance + doubleRate;    doublePayment = (doubleBalance/doubleCount);    sb.append(doublePayment);    sb.append(" ");    doubleCount = doubleCount - 1;    doubleBalance -= doublePayment;}TextView results = (TextView) findViewById(R.id.showResult);results.setText(sb.toString());
```

\
I hope this code might be resolve your problem.


---

Original Source: https://www.mindstick.com/forum/942/how-to-print-multiple-statements-to-one-textview

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
