Android Question InputDialogs Exits without any error

ronovar

Active Member
Licensed User
Longtime User
I have added in apk inputdialogs so that user can enter pin (4 digit numbers) and when i press on remote OK button it exits apk and i don't see any error in logcat in b4a...where i im doing wrong?

This is my code:

B4X:
Sub Activity_KeyUp (KeyCode As Int) As Boolean
   'SELECT - Remote Code
    Select KeyCode
       
Case KeyCodes.KEYCODE_DPAD_CENTER
                    If (Round(clvMasterCh.ScrollPosition/250) <> SelCh-1 And tmrScrollers.Enabled = True) Then
                        SelCh = ScrolledChannel
                        'CHECK - porno lock
                        If (Channels(SelCh, 5) = "false") Then
                            'DEFINE - InputDialog
                            Dim InputDialog1 As InputDialog
                            Dim Ret As Int

                            'SET - Type
                            InputDialog1.InputType = InputDialog1.INPUT_TYPE_NUMBERS
                  
                            'SETTINGS - InputDialog
                            InputDialog1.Input = ""
                            InputDialog1.HintColor = Colors.ARGB(196, 255, 140, 0)
                            Ret = DialogResponse.CANCEL

                            Ret = InputDialog1.Show("CHANNEL Locked. Please Enter PIN:", "Enter PIN", "Yes", "No", "", Null)
                          
                            'VALIDATE - Pin
                            If (InputDialog1.Input = Authorisation(2)) Then
                               'DO some stuff
                               Log("Authorisation Successfull...")
                            End If
                        Else
                          
                               'DO another some stuff
                               Log("Doing another stuff...")
                        End If
                    End If
    End Select
End Sub
 

DonManfred

Expert
Licensed User
Longtime User
Ret = InputDialog1.Show("CHANNEL Locked. Please Enter PIN:", "Enter PIN", "Yes", "No", "", Null)

'VALIDATE - Pin
If (InputDialog1.Input = Authorisation(2)) Then
'DO some stuff
Log("Authorisation Successfull...")
End If
You should first check is ret is the correct POSITIVE value (right after the line Ret = Inputdialog1.Show(...)
 
Upvote 0

ronovar

Active Member
Licensed User
Longtime User
I added as you suggest and apk exits without error:

B4X:
'VALIDATE - Pin
If (Ret = DialogResponse.POSITIVE) Then
   Log("Positive....")
Else
  Log("Negative")
End If

Did i check correct?

When i use Log("ret..."&Ret) i see in Log -3 and apk exits without error...what this -3 means?
 
Upvote 0

ronovar

Active Member
Licensed User
Longtime User
Can you please post example code?

I try with this but apk exits

B4X:
Sub Activity_KeyUp (KeyCode As Int) As Boolean

'SELECT - Remote CodeSelect KeyCode
Case KeyCodes.KEYCODE_DPAD_CENTER

                    If (Round(clvMasterCh.ScrollPosition/250) <> SelCh-1 And tmrScrollers.Enabled = True) Then
                        SelCh = ScrolledChannel
                        'CHECK - porno lock
                        If (Channels(SelCh, 5) = "false") Then
                            CallSubDelayed(Activity, "CheckPorno")
                        Else
                           Log("Doing other sutff..")
                        End If
                    End If

End Select
End Sub

Sub CheckPorno
    'DEFINE - InputDialog
                            Dim InputDialog1 As InputDialog
                            Dim Ret As Int

                            'SET - Type
                            InputDialog1.InputType = InputDialog1.INPUT_TYPE_NUMBERS
                   
                            'SETTINGS - InputDialog
                            InputDialog1.Input = ""
                            InputDialog1.HintColor = Colors.ARGB(196, 255, 140, 0)
                            Ret = DialogResponse.CANCEL

                            Ret = InputDialog1.Show("CHANNEL Locked. Please Enter PIN:", "Message", "Yes", "No", "", Null)

                            'VALIDATE - Pin
                            If (InputDialog1.Input = Authorisation(2)) Then
                               Log("Doing other stuff..")
                            End If
   
End Sub
 
Upvote 0

ronovar

Active Member
Licensed User
Longtime User
OK i added in timer to show input dialog and read input and this works except that input dialog is showd twice or more ...(because timer have inerval of 200ms).
Question is how can i remove from screen InputDialog1?

Something like

B4X:
InputDIalog1.Hide
 
Upvote 0
Top