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
Highlighted
New Developer
Posts: 45
Registered: ‎06-05-2009
My Device: Not Specified

Dialog box prompt.

UiApplication.getUiApplication().invokeLater( new Runnable() { public void run() {

 

 Dialog dia_answer = new Dialog(Dialog.D_YES_NO,"Are you sure you want to upload a new version of "+filename+" ?",Dialog.YES, Bitmap.getPredefinedBitmap(Bitmap.INFORMATION),Dialog.GLOBAL_STATUS);

}

});

 

I have another dialog  box  :-

Dialog statusDlg =  new Dialog("Uploading File...",null,null,0,icon);

which is a modeless dialog box which comes after the user says YES to the dia_answer box.

statusDlg is being invoked using statusDl.show();

 

My problem is that dia_answer box. prompts, I select YES, but the dialog box doesnt go away after I click YES and statusDlg doesnt appear at all.

 

I basically want

 

1. dia_answer dialog box to come up., I say yes, the dialog box should disappear.

2. Then statusDlg to come up

3. On successful completion of task, statusDlg should disappear.

 

Kindly appear.

 

Thanks & Regards,

Vijaya S.

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

Re: Dialog box prompt.

Three options based on your code:

 

1) Add your display of statusDlg into your Runnable

UiApplication.getUiApplication().invokeLater( new Runnable() { public void run() {

 

 Dialog dia_answer = new Dialog(Dialog.D_YES_NO,"Are you sure you want to upload a new version of "+filename+" ?",Dialog.YES, Bitmap.getPredefinedBitmap(Bitmap.INFORMATION),Dialog.GLOBAL_STATUS);

if ( dia_answer == Dialog.YES ) {

Dialog statusDlg =  new Dialog("Uploading File...",null,null,0,icon);

UiApplication.getUiApplication.pushScreen(statusDig);

}

}

});

 

2) replace:

UiApplication.getUiApplication().invokeLater

with

UiApplication.getUiApplication().invokeAndWait

and make sure the following code can retrieve the value of dia_answer and use an invokeLater to display statusDlg.

 

3) Use a DialogClosedListener on dia_answer and process from there.