As long as there is a newline between the lines, you can use the ListView to add the lines and hold the lines themselves in an ArrayList or LinkedList to which you add when AsyncTask receives the lines.
You might also consider invalidating a TextField with a lower reputation; speak 10 times per second. This will certainly improve responsiveness. The following may work:
static long lastTimeUpdated = 0; if( receivedString.size() > 0 ) { myStringBuilder.append( receivedString ); } if( (System.currentTimeMillis() - lastTimeUpdated) > 100 ) { myTextView.setText( myStringBuilder.getChars( 0, myStringBuilder.length() ); }
If the lines get into packets - so that you have a delay between packets more than, say, a second, then reset the timer for each update that will run this code to restart to pick up the final part of the last packet.
source share