Android Question problem Panel

GIS

Well-Known Member
Licensed User
Hi, I have a problem, I Panel becomes visible but the program does not stop. In the panel I have an edittext and a botton. If anyone has an idea of the reason. Thank you
B4X:
#Region  Activity Attributes
    #FullScreen:  True
    #IncludeTitle:  False
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.

End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
   
    Dim myImagine As Bitmap
   
    Private accountEmail As Label
    Private accountPassword As Label
    Private CodAzienda As Label
    Private Cognome As Label
    Private Nome As Label
    Private TitoloAccount As Label
    Private NumInterno As Label
    Private TitoloAccount As Label
    Private NumInterno As Label
   
    Private EditAzienda As EditText
    Private EditCognome As EditText
    Private EditEmail As EditText
    Private EditNome As EditText
    Private EditPassword As EditText      
    Private EditNumInterno As EditText
    Private OkRegistrazione As Button
    Private SfondoAccount As ImageView
   
    Private conferma As Button
    Private num As EditText
    Private tit As Label
    Private Panel1 As Panel
   
    Dim SMTP1 As SMTP
    Dim ListaRegistrati(100) As String
    Dim numVerifica As Long
    Dim inviata As Boolean = False
   
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("Account")
    Panel1.Visible = False
   
    SetLabelSize(TitoloAccount,"REGISTRAZIONE")
   
    myImagine.Initialize(File.DirAssets,"Blue.png")
    OkRegistrazione.SetBackgroundImage(myImagine)

    myImagine.Initialize(File.DirAssets,"Blue.png")
    conferma.SetBackgroundImage(myImagine)

   
   
   




End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub
Sub OkRegistrazione_Click  
   
   
   
   
    EditCognome.Text =  EditCognome.Text.ToUpperCase
    EditNome.Text =  EditNome.Text.ToUpperCase
    EditEmail.Text = EditEmail.Text.ToUpperCase
   
   
   
   
   
    numVerifica = Rnd(100000,999999)
   

   
   
    SalvaAccount(EditNome.Text, EditCognome.Text, EditNumInterno.Text, EditEmail.Text, EditPassword.text)

   
   
End Sub

Sub SalvaAccount( NomeReg As String, CognomeReg As String, NumInternoReg As String, EmailReg As String, PasswordReg As String)
   
        Dim List1 As List
       
       
If EditAzienda.Text = "1234" Then  
   
       
       
       
        If File.Exists(File.DirRootExternal,  "Pizza/Registrazioni.txt") Then
   
    Sviluppatore.ftp.Initialize ("ftp","ftp.xxxxxxxxxxxx.org", 21 , "xxxxxxxxxx", "xxxxxxxxxx")
        Sviluppatore.ftp.PassiveMode = True
        Dim sf As Object = Sviluppatore.ftp.DownloadFile("/pizzagrifalapp/Registrazioni.txt", True, File.DirRootExternal,  "/pizza/Registrazioni.txt" )
        Wait For (sf) FTP_DownloadCompleted (ServerPath As String, Success As Boolean)
            List1 = File.ReadList(File.DirRootExternal, "Pizza/Registrazioni.txt")
               
                For ii = 0 To 99
                ListaRegistrati(ii) = List1.Get(ii)
                   
                Next
                    Dim trovato As Boolean
                    trovato = False
                       
                For i = 0 To 99
                   
                    ListaRegistrati(i) = List1.Get(i)
                   
                    Dim stringArray() As String = Regex.Split("\|",ListaRegistrati(i))
       
       
                 If ListaRegistrati(i) <> "0" Then
                Log(stringArray(3) & "    " & stringArray(4))
               
                         If stringArray(0) = NomeReg And stringArray(1) = CognomeReg   Then
                                             
                           
                                        Msgbox("Cognome e  Nome già Registrati!!!", "ERRORE!!")
                       
                                            Pulisce
                                            trovato =True
                           
                       
                          Else if stringArray(3) = EmailReg Then
                       
                                             Msgbox("E-mail già Registrata!!!", "ERRORE!!")
                       
                                               Pulisce
                                            trovato =True
                       
                       
                         End If
                       
                     Else        
                       
                        If inviata = False Then email
                        OkRegistrazione.Visible = False
                           Panel1.Visible = True
                       
                       
                               
                                       If trovato = False And ListaRegistrati(i) = "0" Then
                                               
                                            ListaRegistrati(i) = NomeReg & "|" & CognomeReg & "|" & NumInternoReg  & "|" & EmailReg  & "|" & PasswordReg
                       
                                            Log( NomeReg & "|" & CognomeReg & "|" & NumInternoReg  & "|" & EmailReg  & "|" & PasswordReg & "......." & i)
                                                trovato = True
                       
                                             'scrivo nel file
                                            File.WriteList(File.DirRootExternal, "Pizza/Registrazioni.txt", ListaRegistrati)
                       
                                            Sviluppatore.ftp.Initialize ("ftp","ftpxxxxxxxxxxxxxxxxxx.org", 21 , "xxxxxxxxxxxxxx", "xxxxxxxxxxxxxxxxx")
                                            Sviluppatore.ftp.PassiveMode = True
              Dim sfu As Object = Sviluppatore.ftp.UpLoadFile(File.DirRootExternal,  "/pizza/Registrazioni.txt",True, "/pizzagrifalapp/Registrazioni.txt" )
                                                Wait For (sfu) FTP_UploadCompleted (ServerPath As String, Success As Boolean)
                                       
                                             Msgbox("Registrazione completata2", "")
                                             StartActivity(Main)
                                        End If
                       
                    End If  
                   
                '    Log(ListaRegistrati(i))
                '    Log(trovato)
                   
                Next          
    trovato = False
   
        Else ' se il file non esiste
   
            For i=0 To 99
               
                ListaRegistrati(i) = "0"
                               
            Next
       
            ListaRegistrati(0) = NomeReg & "|" & CognomeReg & "|" & NumInternoReg  & "|" & EmailReg  & "|" & PasswordReg
       
            'Crea la directory
            File.MakeDir(File.DirRootExternal, "Pizza")
           
            'scrivo nel file che se non c'è me lo crea
            File.WriteList(File.DirRootExternal, "Pizza/Registrazioni.txt", ListaRegistrati)
            Sviluppatore.ftp.Initialize ("ftp","xxxxxxxxxxxxxxxx.org", 21 , "xxxxxxxxxxxxxx", "xxxxxxxxxxxxxxxxxxxx")
            Sviluppatore.ftp.PassiveMode = True
            Dim sfu As Object = Sviluppatore.ftp.UpLoadFile(File.DirRootExternal,  "/pizza/Registrazioni.txt",True, "/pizzagrifalapp/Registrazioni.txt" )
            Wait For (sfu) FTP_UploadCompleted (ServerPath As String, Success As Boolean)
                                       
       
            Msgbox("Registrazione completata1", "")
            StartActivity(Main)
   
    End If
   
Else  
     Pulisce
     Msgbox("Codice Azienda, Errato!!!", "ERRORE!!")
   
   
End If  
   
End Sub


Sub email
   
    'funziona per inviare e-mail
    SMTP1.Initialize("smtp.gmail.com", 465, "[email protected]","xxxxxxxxxxxxxx","SMTP")
    SMTP1.UseSSL = True
    SMTP1.To.Add(EditEmail.Text)
    SMTP1.Subject = "Numero di verifica"
    SMTP1.Body = "Numero di verifica e-mail dell'app SPEEDY PIZZA" & "  " & numVerifica
    SMTP1.Send
    inviata = True
   
End Sub

Sub Pulisce
   
    EditAzienda.Text = ""
    EditCognome.Text = ""
    EditNome.Text =  ""
    EditNumInterno.Text =  ""
    EditPassword.text =  ""
    EditEmail.Text = ""
   
   
End Sub

Sub FTP_UploadCompleted (ServerPath As String, Success As Boolean)
   
    Log(ServerPath & " UP Success=" & Success)
    If Success = False Then Log(LastException.Message)
   
End Sub

Sub FTP_DownloadCompleted (ServerPath As String, Success As Boolean)
   
    Log(ServerPath & " DOW Success=" & Success)
    If Success = False Then Log(LastException.Message)
   
End Sub

'questo serve a modificare la grandezza del testo nella label
Sub SetLabelSize(lbl As Label, txt As String)
    Dim dt As Float
    Dim limit = 0.5 As Float
    Dim h As Int
 
    lbl.Text = txt
    lbl.TextSize = 72
    dt = lbl.TextSize
    h = Main.stu.MeasureMultilineTextHeight(lbl, txt)
    Do While dt > limit Or h > lbl.Height
        dt = dt / 2
        h = Main.stu.MeasureMultilineTextHeight(lbl, txt)
        If h > lbl.Height Then
            lbl.TextSize = lbl.TextSize - dt
            lbl.TextSize = lbl.TextSize - 1 'ho aggiunto questo meno 1 se no a volte la scritta era grande e non si leggeva
        Else
            lbl.TextSize = lbl.TextSize + dt
            lbl.TextSize = lbl.TextSize - 1 'ho aggiunto questo meno 1 se no a volte la scritta era grande e non si leggeva
        End If
    Loop
End Sub
   

'questo serve a modificare la grandezza del testo nel bottone
Sub SetButtonTextSize(lbl As Button, txt As String)
    Dim dt As Float
    Dim limit = 0.5 As Float
    ' Dim limit = 1 As Float
    Dim h As Int
 
    lbl.Text = txt
    lbl.TextSize = 72
    dt = lbl.TextSize
    h = Main.stu.MeasureMultilineTextHeight(lbl, txt)
    Do While dt > limit Or h > lbl.Height
        dt = dt / 2
        h =Main.stu.MeasureMultilineTextHeight(lbl, txt)
        If h > lbl.Height Then
            lbl.TextSize = lbl.TextSize - dt
            lbl.TextSize = lbl.TextSize - 2 'ho aggiunto questo meno 2 se no era grande e andava fuori dal bottone
        Else
            lbl.TextSize = lbl.TextSize + dt
            lbl.TextSize = lbl.TextSize - 2 'ho aggiunto questo meno 2 se no era grande e andava fuori dal bottone
        End If
    Loop
End Sub



Sub conferma_Click
   
    If numVerifica <> num.Text Then
       
        Msgbox("Verifica E-mail Errata!!!", "ERRORE!!")
        Activity.Finish
       
    End If
   
   
End Sub
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
Please upload a small project which shows the issue.
 
Upvote 0

GIS

Well-Known Member
Licensed User
I put this at the bottom there is panel1.visible = true which is where I have the problem. I do not know what can be useful to understand for what I had put everything. As I wrote in the first post the program displays the panel but continues execution. You should stop because I have an editText and a button.


B4X:
For ii = 0 To 99
                ListaRegistrati(ii) = List1.Get(ii)
                  
                Next
                    Dim trovato As Boolean
                    trovato = False
                      
                For i = 0 To 99
                  
                    ListaRegistrati(i) = List1.Get(i)
                  
                    Dim stringArray() As String = Regex.Split("\|",ListaRegistrati(i))
      
      
                 If ListaRegistrati(i) <> "0" Then
                Log(stringArray(3) & "    " & stringArray(4))
              
                         If stringArray(0) = NomeReg And stringArray(1) = CognomeReg   Then
                                            
                          
                                        Msgbox("Cognome e  Nome già Registrati!!!", "ERRORE!!")
                      
                                            Pulisce
                                            trovato =True
                          
                      
                          Else if stringArray(3) = EmailReg Then
                      
                                             Msgbox("E-mail già Registrata!!!", "ERRORE!!")
                      
                                               Pulisce
                                            trovato =True
                      
                      
                         End If
                      
                     Else       
                      
                        If inviata = False Then email
                        OkRegistrazione.Visible = False
                           Panel1.Visible = True
 
Upvote 0

GIS

Well-Known Member
Licensed User
ok then now I see. I'm away from home and I can not do anything else. Anyway, I've finished the code and do not pretend that you write it. I only have that problem that I described I can not understand why does not work. I can not understand why it does not stop on the panel but continues with the execution. Ty
 
Upvote 0
Top