Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ThreadHelper {
- private TextView textView;
- public ThreadHelper(TextView textView) {
- this.textView = textView;
- }
- public void runOnAnotherThread() {
- Thread thread = new Thread(new Runnable() {
- @Override
- public void run() {
- textView.post(new Runnable() {
- @Override
- public void run() {
- textView.setText("FirstText");
- }
- });
- }
- });
- thread.start();
- }
- public void addText(final String text){
- textView.post(new Runnable() {
- @Override
- public void run() {
- textView.setText(textView.getText() + "\n" + text);
- }
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement