Hello guys!
It has been driving me nuts since last night. I am testing on two devices:
HTC Desire Android 2.2
Next7 Tablet Android 4.0
Here is the Dialogs code:
The problem is that on my tablet(Android 4.0), the dialog returns the value immediately. If it matters, the returned value is -3. So, I call .Show() but get the result together with that. The result is that the user can't type anything immediately and when they do it, the Sub has probably already returned and nothing happens. Once again, I get the messagebox "You have to specify non-null quantity" immediately, together with the Dialog showing...!?
On the HTC Desire, this works perfectly. It waits for the user to choose quantity and when they click "OK", it is then that the rest of the logic is executed.
I definitely classify it as a bug. However, is there anything that I am missing to workaround it?
It has been driving me nuts since last night. I am testing on two devices:
HTC Desire Android 2.2
Next7 Tablet Android 4.0
Here is the Dialogs code:
B4X:
Sub updateQuantity(theProduct As tProduct)
zCommon.LogT("requestQuantity() theProduct = " & theProduct , "")
Dim quantityDialog2 As InputDialog
quantityDialog2.InputType = quantityDialog2.INPUT_TYPE_PHONE
quantityDialog2.Hint = "How much?"
If(theProduct.Field1<> 0) Then
quantityDialog2.Input = theProduct.Field5
End If
quantityDialog2.Show("The quantity for this product (e.g 1 item)", _
"Enter Quantity", "Save", "Cancel", "", Null)
Msgbox(quantityDialog2.Response, "") ' this is triggered together with the dialog popup. Instead of waiting to click "OK/Cancel", etc..., the result is ready immediately.
Dim quantity As Double
Try
quantity = quantityDialog2.Input
Catch
quantity = 0
End Try
'Dim quantity As Double : quantity = 5 ' if I comment out the dialogs and use constant value, my logic below works. With a dialog, it is never executed.
If(quantity <> 0) Then
theProduct.Initialize(theRecipeProduct.Field1, _
theProduct.Field2, _
theProduct.Field3, _
theProduct.Field4, _
quantity, _
theProduct.Field6)
sqlProducts.LinkIt(theProduct)
painter("RELOAD")
Else
zCommon.showError("You have to specify not-null quantity!", _
"Error")
End If
The problem is that on my tablet(Android 4.0), the dialog returns the value immediately. If it matters, the returned value is -3. So, I call .Show() but get the result together with that. The result is that the user can't type anything immediately and when they do it, the Sub has probably already returned and nothing happens. Once again, I get the messagebox "You have to specify non-null quantity" immediately, together with the Dialog showing...!?
On the HTC Desire, this works perfectly. It waits for the user to choose quantity and when they click "OK", it is then that the rest of the logic is executed.
I definitely classify it as a bug. However, is there anything that I am missing to workaround it?
Last edited: