Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 231
Registered: ‎03-16-2011
My Device: 9700, 9550, and JDE
My Carrier: AIRTEL, BSNL
Accepted Solution

Problem In Creating Alert Dialog

i m getting problem in creating Dialog from non event thread. I want to alert a Dialog from listener class. And for this i used this code

 UiApplication.getUiApplication().invokeLater(new Runnable(){

                 public void run(){

                   Dialog.alert(" Loading...");

                 }

               }); 

 

this is created on documentCreated method of BrowserListener, but after this dilog, browserField says that owner thread died. what should be the solution in this case???

 


available on: Monday to Friday, Indian standard (day) time : )
  • Give kudos by clicking on the star icon to say "Thanks!" if you feel this response is helpful.
  • Click "Accept as Solution" if this post was what you needed. so that people who are trying to help will not waste their time reading a thread where no help is needed.

Contributor
Posts: 11
Registered: ‎03-04-2010
My Device: 9000
My Carrier: vodafone

Re: Problem In Creating Alert Dialog

This works perfectly for me.Can you elaborate on the problem or if possible paste code?

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Problem In Creating Alert Dialog

Just an idea, probably not a very good one.....

 

I suspect you are processing on the Event Thread when you try to do this.  Can you add the following code prior to this and tell us what happens?

 

if ( UiApplication.isEventDispatchThread() ) {

Dialog.alert("running on Event Thread");

}

 

If you find the Dialog is being displayed, then I think you need to rework your processing so that you are not running on the Event Thread. 

Developer
Posts: 231
Registered: ‎03-16-2011
My Device: 9700, 9550, and JDE
My Carrier: AIRTEL, BSNL

Re: Problem In Creating Alert Dialog

Ya its now working............. dont know why it was giving error earlier

 

@peter:::: while m trying to put following code it doesnt show dialog

if ( UiApplication.isEventDispatchThread() ) {

Dialog.alert("running on Event Thread");

}

 

 

however in both cases, there were exceptions sometime, not its working, any idea why???


available on: Monday to Friday, Indian standard (day) time : )
  • Give kudos by clicking on the star icon to say "Thanks!" if you feel this response is helpful.
  • Click "Accept as Solution" if this post was what you needed. so that people who are trying to help will not waste their time reading a thread where no help is needed.

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Problem In Creating Alert Dialog

" while m trying to put following code it doesnt show dialog"

Excellent, that is what I hoped.

 

No idea why you would have exceptions sorry.