I have 2 classes. At the end of the ConnectThread I want to open a new activity. This code I found on StackOverflow but it doensn't work. Can anyone tell me how to solve this.

```
public class MainActivity extends Activity {
    // some code

}

class ConnectThread extends Thread {

    Handler handler = new Handler(Looper.getMainLooper());

    public ConnectThread(BluetoothDevice device) {  
        // some code
    }

    public void run() {  
        // some code

        handler.post(new Runnable() {

            @Override
            public void run() {
                Intent startPostGet = new Intent(MainActivity.this, PostGetActivity.class);                    
                startActivity(startPostGet);
            }
        });   
    }
}

```