Since 2 days I am facing a strange problem. I am making an application where I need alert dialogue with two button (e.g.) Yes/No
I am calling one method (in which I have written stuff for alert box) on click event of a button. The alert box code works fine.As far as my knowledge is concern the next line in calling function will get executed only after the called function finishes it's task.
Here is a code to review...
Below is Button's click event from where I am calling a function validateFields();
Below is code for validateFileds();
For a moment forget that yes/no button code.Just focus on OK button code.
Now this code gives alert whenever 'to' (EditText's object) is empty.
But before I press OK control comes out of validateFields() and executes the next line in onClick method.
Ankit Garg wrote:When you show an alert box, the code won't stop executing there. The code will continue to execute even if the alert is still visible...
Hi Ankit, Thank you for the reply. But I think then alert box is of no use.Now if I want to use yes/no alert box and I need to do some action on basis of the button which is pressed by user then in that case what should I do?
I know there is onClick method for positive and negative button. But what to do to pause the control of a program.
As you said yourself, you have an event listener to execute some code based upon the button clicked in the alert box. Still if you want "pause" the execution till a button is pressed in the alert box, you can use the normal wait and notify mechanism of java...
Joined: Jan 30, 2010
Again thanking you for reply.As you told me I tried wait and notify methods.It partially solve my problem.
The new problem is alert box's show() method is not displayed.Using LogCat I traced the flow, then I came to know that thread works fine but some how code fails to display alert box.
Following is the code with thread implementation.
Below is validateFields() method..
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com