I've been running into this bug and I can't seem to figure out how to fix it as I'm fairly new to java and android development so I would really appreciate any help I could get with this!

The bug I'm running into is that when I'm using `.setText()` to update a `TextView` element periodically the text displayed on screen never actually changes.

I believe this is due to the while(true) loop in the `startCrunching()` method I'm using to run the main calculation process as before I start that method the screen updates fine with the test data I'm feeding it.

I also know that when the while loop starts the `updateScreen()` method is only being called from the while loop and not the repeating handler I have as the handler stops posting logs to the logcat when the method starts but then the while loop logs start being posted.

What I want to achieve is the while(true) loop running as quickly as possible while every so often (as a variable of time and not cycles of the while loop) updating the screen with information regarding the process in the while loop.

I know the while loop is running and the `updateScreen()` method is being called.

Full source below:

```
package com.example.android.collatzconjecturepathcruncher;

import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import java.math.BigInteger;
import java.util.concurrent.TimeUnit;

public class MainActivity extends AppCompatActivity {

    TextView longestPathDisplay;
    TextView longestPathSeedDisplay;
    TextView currentSeedDisplay;
    EditText startingNumberDisplay;

    BigInteger longestPathSeed= BigInteger.ONE;
    int longestPath=0;
    BigInteger currentSeed=BigInteger.ZERO;
    int currentPath=0;
    BigInteger workingSeed=BigInteger.ONE;
    boolean run;

    int temp =0;

    private Handler mHandler;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        longestPathDisplay = findViewById(R.id.longest_path);
        longestPathSeedDisplay = findViewById(R.id.longest_path_seed);
        currentSeedDisplay = findViewById(R.id.current_seed_display);
        startingNumberDisplay = findViewById(R.id.starting_number_display);

        longestPathDisplay.setText(getString(R.string.longest_path_display,longestPath));
        longestPathSeedDisplay.setText(getString(R.string.longest_path_seed_display,longestPathSeed));
        currentSeedDisplay.setText(getString(R.string.current_seed_display,currentSeed));

        mHandler = new Handler();
        startRepeatingTask();
    }

    @Override
    public void onDestroy(){
        super.onDestroy();
        stopRepeatingTask();
    }

    public void startCrunching(View view){

        String value = startingNumberDisplay.getText().toString();
        currentSeed = new BigInteger(value);

        workingSeed=currentSeed;

        run=true;

        while(run){

            if(workingSeed.compareTo(BigInteger.ONE)==0){

                if(currentPath>longestPath){
                    longestPath=currentPath;
                    longestPathSeed=currentSeed;
                }
                currentSeed= currentSeed.add(BigInteger.ONE);
                workingSeed=currentSeed;
                Log.d("end", "startCrunching: Finished "+(currentSeed.subtract(BigInteger.ONE))+" at "+currentPath+". Starting "+currentSeed);
                currentPath=0;
                updateScreen();
            }

            if (workingSeed.mod(new BigInteger("2")).compareTo(BigInteger.ZERO)==0){
                workingSeed=workingSeed.divide(new BigInteger("2"));
            }else{
                workingSeed=(workingSeed.multiply(new BigInteger("3"))).add(BigInteger.ONE);
            }
            currentPath++;
        }

    }

    public void updateScreen() {

        //longestPathDisplay.setText(getString(R.string.longest_path_display, longestPath));
        //longestPathSeedDisplay.setText(getString(R.string.longest_path_seed_display, longestPathSeed));
        //currentSeedDisplay.setText(getString(R.string.current_seed_display, currentSeed));

        longestPathDisplay.setText(getString(R.string.longest_path_display, temp));
        longestPathSeedDisplay.setText(getString(R.string.longest_path_seed_display, temp));
        currentSeedDisplay.setText(getString(R.string.current_seed_display, temp));
        Log.d("update","requested screen update. Temp currently: "+temp);
        temp++;
    }

    Runnable mStatusChecker = new Runnable() {
        @Override
        public void run() {
            try{
                updateScreen();
                Log.d("repeat","Tried Updating Screen");
            }finally {
                mHandler.postDelayed(mStatusChecker,5000);
            }
        }
    };

    void startRepeatingTask(){
        mStatusChecker.run();
    }

    void stopRepeatingTask() {
        mHandler.removeCallbacks(mStatusChecker);
    }

}

```

Thanks in advance!
-Michael