Android Question If Statement Not Functioning

Kope

Active Member
Licensed User
Am currently working on a Sign up Page of my App and it doesn't seem to be working properly. I have tried very available means but to no avail.

so after completing the textbox, the user tap on the sign up to verify Phone Number. This Activity opens when the OTP is delivered successfully hence "Correct". The App failed to move to the Verification Page when the OTP is delivered.

This also happens in some other activities

Please i Need Help
ice_screenshot_20230120-160712.png
 

Kope

Active Member
Licensed User
Where is the small projectupload showing the problem?
Hard to help by guessing.

Where is the error-log/stacktrace?
Can’t upload since it’s Server App and using localhost.
There’s no error?

I received the the response “Correct” which is log but the next line ie Line 93 is not executing
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
I received the the response “Correct” which is log
You can not see any spaces and invisible characters.
You need to find out the difference if any.

- Convert the string to hex and log the hexoutput for example.
- log the output of res.compareto("Correct")
 
Upvote 0

Kope

Active Member
Licensed User
You can not see any spaces and invisible characters.
You need to find out the difference if any.

- Convert the string to hex and log the hexoutput for example.
- log the output of res.compareto("Correct")
The log is giving -57
 
Upvote 0

Rubsanpe

Active Member
Licensed User
Hello, maybe it is not same encode? Use the hexadecimal view to see what exactly the returned value contains.

Rubén
 
Last edited:
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
So if the 2 strings are the same then it will return 0.

Lexicographically means character by character, i believe.
so getting a -57 sounds like the string he got is not equal to "Complete". Whatever additional characters there may be ;-)
 
Upvote 0

Knoppi

Active Member
Licensed User
Longtime User
There are any spaces or invisible characters.
Try this
B4X:
...
Dim res As String = http1.GetString
Log($">${res}<"$)   'should be: >Correct<
If res="Correct" then
...
 
Upvote 0

William Lancee

Well-Known Member
Licensed User
Longtime User
This might be useful to you. It is to me. I like to see all characters, especially in unknown strings from the web.

B4X:
Private Sub testRevealString
    Dim aString As String = $"This ${Chr(0x001B)} is a invisible character "$        'note space at end which is also not visible
    Log(aString)
    Log(revealString(aString))
End Sub

Private Sub revealString(s As String) As String
    Dim InvisibleChrs As String = $"
    U+0000 NULL
    U+0001 START OF HEADING (SOH)
    U+0002 START OF TEXT (STX)
    U+0003 END OF TEXT (ETX)
    U+0004 END OF TRANSMISSION (EOT)
    U+0005 END OF QUERY (ENQ)
    U+0006 ACKNOWLEDGE (ACK)
    U+0007 BEEP (BEL)
    U+0008 BACKSPACE (BS)
    U+0009 HORIZONTAL TAB (HT)
    U+000A LINE FEED (LF)
    U+000B VERTICAL TAB (VT)
    U+000C FF (FORM FEED)
    U+000D CR (CARRIAGE RETURN)
    U+000E SO (SHIFT OUT)
    U+000F SI (SHIFT IN)
    U+0010 DATA LINK ESCAPE (DLE)
    U+0011 DEVICE CONTROL 1 (DC1)
    U+0012 DEVICE CONTROL 2 (DC2)
    U+0013 DEVICE CONTROL 3 (DC3)
    U+0014 DEVICE CONTROL 4 (DC4)
    U+0015 NEGATIVE ACKNOWLEDGEMENT (NAK)
    U+0016 SYNCHRONIZE (SYN)
    U+0017 END OF TRANSMISSION BLOCK (ETB)
    U+0018 CANCEL (CAN)
    U+0019 END OF MEDIUM (EM)
    U+001A SUBSTITUTE (SUB)
    U+001B ESCAPE (ESC)
    U+001C FILE SEPARATOR (FS) RIGHT ARROW
    U+001D GROUP SEPARATOR (GS) LEFT ARROW
    U+001E RECORD SEPARATOR (RS) UP ARROW
    U+001F UNIT SEPARATOR (US) DOWN ARROW
    U+001F SPACE
    U+0009 CHARACTER TABULATION
    U+00A0 NO-BREAK SPACE
    U+00AD SOFT HYPHEN
    U+034F COMBINING GRAPHEME JOINER
    U+061C ARABIC LETTER MARK
    U+115F HANGUL CHOSEONG FILLER
    U+1160 HANGUL JUNGSEONG FILLER
    U+17B4 KHMER VOWEL INHERENT AQ
    U+17B5 KHMER VOWEL INHERENT AA
    U+180E MONGOLIAN VOWEL SEPARATOR
    U+2000 EN QUAD
    U+2001 EM QUAD
    U+2002 EN SPACE
    U+2003 EM SPACE
    U+2004 THREE-PER-EM SPACE
    U+2005 FOUR-PER-EM SPACE
    U+2006 SIX-PER-EM SPACE
    U+2007 FIGURE SPACE
    U+2008 PUNCTUATION SPACE
    U+2009 THIN SPACE
    U+200A HAIR SPACE
    U+200B ZERO WIDTH SPACE
    U+200C ZERO WIDTH NON-JOINER
    U+200D ZERO WIDTH JOINER
    U+200E LEFT-TO-RIGHT MARK
    U+200F RIGHT-TO-LEFT MARK
    U+202F NARROW NO-BREAK SPACE
    U+205F MEDIUM MATHEMATICAL SPACE
    U+2060 WORD JOINER
    U+2061 FUNCTION APPLICATION
    U+2062 INVISIBLE TIMES
    U+2063 INVISIBLE SEPARATOR
    U+2064 INVISIBLE PLUS
    U+206A INHIBIT SYMMETRIC SWAPPING
    U+206B ACTIVATE SYMMETRIC SWAPPING
    U+206C INHIBIT ARABIC FORM SHAPING
    U+206D ACTIVATE ARABIC FORM SHAPING
    U+206E NATIONAL DIGIT SHAPES
    U+206F NOMINAL DIGIT SHAPES
    U+3000 IDEOGRAPHIC SPACE
    U+2800 BRAILLE PATTERN BLANK
    U+3164 HANGUL FILLER
    U+FEFF ZERO WIDTH NO-BREAK SPACE
    U+FFA0 HALFWIDTH HANGUL FILLER
"$
    Private lookup As Map    'Make this global to avoid recreating it each time
    If lookup.IsInitialized = False Then
        lookup.Initialize
        Dim v() As String = Regex.Split(CRLF, InvisibleChrs)
        For Each t As String In v
            t = t.Trim
            If t.Length = 0 Then Continue
            Dim hex As String = t.SubString2(2, 6)
            Dim number As Int = Bit.ParseInt(hex, 16)
            lookup.Put(number, hex)
        Next
    End If
    Dim sb As StringBuilder
    sb.Initialize
    For i = 0 To s.Length - 1
        Dim c As String = s.CharAt(i)
        Dim cint As Int = Asc(c)
        If lookup.ContainsKey(cint) Then
            sb.Append("{0x").Append(lookup.Get(cint)).Append("}")
        Else if i = s.Length - 1 And c= " " Then
            sb.Append("{SPACE").Append("}")
        Else
            sb.Append(c)           
        End If
    Next
    Return sb.toString
End Sub
 
Upvote 0

netsistemas

Active Member
Licensed User
Longtime User
It won't be a problem if you do, it runs before the download in any case.
That is, perhaps a waitfor is missing until the download is complete.
 
Upvote 0
Top