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
misty83
Posts: 745
Registered: ‎01-04-2009
My Device: 8300, 8800, 8700f, 9000

Re: how to get value of chosen choice in question dialog?

hmm, but actually how? ok i can write a DialogClosedListener, add it to my dialog-but still-how can i recognize in this listener which value was clicked (YES/NO) ??

Please use plain text.
Developer
simon_hain
Posts: 15,947
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: how to get value of chosen choice in question dialog?

Interface DialogClosedListener

public void dialogClosed(Dialog dialog,
int choice)

 

choice tells you the selected field.

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Developer
misty83
Posts: 745
Registered: ‎01-04-2009
My Device: 8300, 8800, 8700f, 9000

Re: how to get value of chosen choice in question dialog?

great, it works! thx :smileyhappy:
Please use plain text.
Developer
misty83
Posts: 745
Registered: ‎01-04-2009
My Device: 8300, 8800, 8700f, 9000

Re: how to get value of chosen choice in question dialog?

actually i still have one question. my problem is:

i've got class A with a method test which returns boolean value. in test method i call a method which shows me a dialog (it is a backgroud app, the same one) and i add this DialogClosedListener. the problem is, that dialogClosed returns void.. so after the user clicks YES/NO, the code in dialogClosed is done but i cannot return the value!

 

class A{

 

public booleantest(){

 

showMessage("message", new MyDialogClosedListener());

}

 

}

 

public MyDialogClosedListener implements DialogClosedListener(){

 

  public void dialogClosed(Dialog dialog, int choice){

    .//proper code here

 

}

}

 

so, as You can see-when i get into 'proper code' in dialogClosed my method test cannot return boolean value!

i hope You can understand what my problem is..

Can any of You suggest me smth?

 

 regards

Please use plain text.
Developer
simon_hain
Posts: 15,947
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: how to get value of chosen choice in question dialog?

returning a value is only one way to continue with a result. using a callback is another. you have to process the result in your callback.

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Developer
misty83
Posts: 745
Registered: ‎01-04-2009
My Device: 8300, 8800, 8700f, 9000

Re: how to get value of chosen choice in question dialog?

but  do not know how. i've tried using timer which reads value of an int which is set when dialog is pressed. but it does not work as it should :/ can You please provide me a simple example?

 

 regards

Please use plain text.