Waiting for DialogActivity to return before continuing executing of the main thread

Posted by jax on Stack Overflow See other posts from Stack Overflow or by jax
Published on 2010-05-22T13:12:19Z Indexed on 2010/05/22 15:40 UTC
Read the original article Hit count: 152

Filed under:

How would I force the current thread to wait until another has finished before continuing.

In my program the user selects a MODE from an AlertDialog, I want to halt executing of the program before continuing as the mode holds important configuration for the gameplay.

        new AlertDialog.Builder(this)
    .setItems(R.array.game_modes, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            switch (which) {
            case 0:
                setMode(TRAINING_MODE);
            case 1:
                setMode(QUIZ_MODE);
            default:
                setMode(TRAINING_MODE);
                break;
            }

            //continue loading the rest of onCreate();
            contineOnCreate();
        }
    })
    .create().show();

If this is impossible can anyone give a possible solution?

© Stack Overflow or respective owner

Related posts about android