I am trying to display a progress bar using threading .. I accept that I do not have that much concept of threading.

**Here is the code**

```
public class Progress extends Activity {

    static String[] display;
    private static final int Progress = 0;      
    private ProgressBar mProgress;
    private int mProgressStatus = 0;
    private Handler mHandler = new Handler();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.progress);

        mProgress = (ProgressBar) findViewById(R.id.progressBar);

        // Start lengthy operation in a background thread
        new Thread(new Runnable() {
            public void run() {
                while (mProgressStatus < 100) {
                    mProgressStatus = doWork();

                    // Update the progress bar
                    mHandler.post(new Runnable() {
                        public void run() {
                            mProgress.setProgress(mProgressStatus);
                        }
                    });
                }
            }

            private int doWork() {                  
                display = new Logic().finaldata();
                // TODO Auto-generated method stub
                return 100;
            }
        }).start();
    }
}

```

On running, the logcat message is 

> 
> java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
> 
> 
> 

What is the mistake that I am doing here?