ricky khatri
ricky khatri

Reputation: 91

Blackberry Thread Exception

how to kill a thread in blackberry. I am using below code in which i want to kill a thread when dialog popup. On first time login failed it is working properly but on second time login failed it returns RunTimeException.

public void onAuthFailed(String message) {
        //this.invokeAndWait(new NotifyDialog("Please enter correct username and password"));
        UiApplication.getUiApplication().invokeLater(new Runnable(){
            public void run(){
                Dialog.alert("Please enter correct username and password.");
                UiApplication.getUiApplication().pushScreen(loginscreen);
            }
        });
    }

Upvotes: 0

Views: 126

Answers (1)

user784540
user784540

Reputation:

Code you posted is not dedicated to kill a thread. It will display a new screen. And I thing you are trying to display a screen object, that is already displayed. I. e loginscreen instance is already displayed. If loginscreen is not displayed, then there's confict (event lock) between new dialog box and screen to be displayed. Display dialog box and screen in different threads.

Check this tutorial: http://www.javabeginner.com/learn-java/java-threads-tutorial

I think it will help.

Upvotes: 1

Related Questions