Im trying to make a program that when i press a button it will show the speed of my arduino car and the distance travelled. Im trying to constantly update the distance in TextView.

Here is my initialization of Handler in the onCreate() that should set my TextView text to distance: 

```
mHandler = new Handler() {
        public void handleMessage(Message msg) {
            Bundle bundle = msg.getData();
            String stringss = bundle.getString("myKey");
            tv2 = (TextView) findViewById(R.id.zval);
            tv2.setText("Distance is :  " + stringss);
        }
    };

```

And here is my thread that does the work in the background

```
btnDist.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Runnable runnable = new Runnable() {
                public void run() {
                    Message msg = mHandler.obtainMessage();
                    Bundle bundle = new Bundle();
                    int distance = distanta(); //function that returns distance/secound
                    int dist = 0;
                    while(distance > 0) {
                        try {
                            Thread.sleep(1000);                 //1000 milliseconds is one second.
                        } catch (InterruptedException ex) {
                            Thread.currentThread().interrupt();
                        }

                        dist += distance;
                    }
                        String dateString = String.valueOf(dist);
                        msg(dateString);
                        bundle.putString("myKey", dateString);
                        msg.setData(bundle);
                        mHandler.sendMessage(msg);

                }
            };
            Thread mythread = new Thread(runnable);
            mythread.start();
        }
    });

```

The application runs and doesn't crash but my textview doesn't get updated at all.
 I'm new to java threads so i might have done something wrong. Thanks!