Hi Erel, thank you very much for your answer.
I've tried the callsubdelayed solution and it didn't work. I've moved the dialog logic to another sub and call it with callsubdelayed, but the same happes. I've tried moving the input-sub to a service, but I get an exception: (BadTokenException) android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
So, maybe I'm doing something wrong or there is a particular issue with the things I use; I'm pasting the code behind.
But, in order to keep learning, I'd also like to ask:
- Why does this (could) happen? (I think that if you suggest some solution is because you have some ideas)
- Why using a regular panel would be a better solution?
- I'm not sure I see how to implement the panel solution. Shall I add, by code, a panel all over the other views, with a thextbox and 2 buttons in the center?
Thank you very much for your awesome support!
'osender is a parameter with the sender object that fired the event (a button)
Sub InputValorAddORemove(sMensaje As String, oSender As Object) As Int
Dim BD As BetterDialogs
Dim DR As Int
Dim IP As BD_InputBoxParams
Try
IP.Initialize
IP.Question = "Value to add2"
IP.QuestionTextSize = 18
IP.SpaceBetween = 4dip
IP.InputTextSize = 24
IP.InputType = IP.INPUT_TYPE_NUMBERS
IP.Gravity = Gravity.CENTER_VERTICAL + Gravity.CENTER_HORIZONTAL
IP.ValidationCallback = "Input_Validation"
IP.WithSuggestions = True
DR = BD.InputBox("Add a Value2", IP, "Add", "Cancel", "", Null)
Log("DR=" & DR)
If DR = DialogResponse.POSITIVE Then
CallSubDelayed3(Me, "ModificarValor", oSender, IP.Answer)
End If
Catch
LogColor(LastException, Colors.Yellow)
End Try
End Sub
Sub Input_Validation(Answer As String, CompactAnswer As String) As String
If CompactAnswer = "" Then
Return "Cannot be empty"
Else
Return ""
End If
End Sub