I’m new in android developement. I’m doing an application that will go through some process and in the process, something happens. So I want a visual console in my activity screen to see what is going on. The idea is a textview in which I insert lines and it has to be refreshed always in the last line and be able to scroll to the start.
How can I do this in code?
Thanks
If you have a simple
TextViewwith a fixed size, within aScrollView, it will behave exactly like you want. The only thing you have to do is make sure you don’t overwrite the existing text each time, but append it to the end. Keep a reference to the actual content of theTextView(a simpleStringwould do), and update it accordingly, then usemyTextView.setText(newValue)When you set the text to the
TextView, the view will be refreshed automatically.And in your activity, when you want to add
newTextto your view:And finally I would also recommend to scroll down to the last line: call
fullScroll(View.FOCUS_DOWN)on theScrollView.