Android Question For / next cycle with JobDone

Discussion in 'Android Questions' started by marcos, Apr 23, 2019.

Tags:
Thread Status:
Not open for further replies.
  1. marcos

    marcos Member Licensed User

    I need to retrieve the records from a db sqlite and pass them to a web service through job.PostString.
    only the last record is passed to the web service, also If cursor1.RowCount> 0. where am I wrong? how can i pass all the records?

    Code:
    Job.Initialize("Job", Me)

        
    cursor = SQL1.ExecQuery("SELECT * FROM nome")
                          
        
    If cursor.RowCount > 0 Then
            
    For i = 0 To cursor.RowCount - 1
                
    cursor.Position = i
              
           Job.PostString(WS,
    "nome="&cursor.GetString("nome")&" ")
        
    Next
     
  2. DonManfred

    DonManfred Expert Licensed User

    Erel likes this.
  3. marcos

    marcos Member Licensed User

    thanks DonManfred is perfect :)
     
  4. marcos

    marcos Member Licensed User

    Sorry it's perfect for sdkVersion <17, but with Android 9 it always goes wrong.
    Code:
    If cursor1.RowCount > 0 Then
            
    For i = 0 To cursor1.RowCount - 1
                cursor1.Position = i

                    j.Initialize(
    "", Me)
                        j.PostString(WS,
    "a="&cursor1.GetString("name")&"")
                    
    Wait For (j) JobDone(j As HttpJob)
                    
    Log(j.GetString)
                                
    If j.Success = True Then
                    
                    
    Msgbox("ok")
                
    End If
                j.Release
            
    Next
    mistake :
    Log(j.GetString) = java.io.FileNotFoundException: /data/user/0/xxxxxxxxxxxxxx/cache/1 (No such file or directory).


    what can it be ? the data in cursor1.GetString ("name") is present :-(
     
  5. OliverA

    OliverA Expert Licensed User

    You’re logging j.GetString before testing if j.Success is true. If j.Success happens to be false, j.GetString will have no content and throw this error. Also you are not logging j.ErrorMessage in case j.Success is false, so it’s hard to tell what is going on.
     
    mangojack likes this.
  6. Computersmith64

    Computersmith64 Well-Known Member Licensed User

    Code:
    If j.Success = True Then
        
    Msgbox("ok")
    End If
    Don't use Msgbox for logging. Use Log("ok") instead & you won't interrupt your loop.

    - Colin.
     
    mangojack likes this.
  7. marcos

    marcos Member Licensed User

    ok. I ran Log( j.ErrorMessage) is receive error : javax.net.ssl.SSLHandshakeException: Connection closed by peer...... for sdk version 28, while it is ok for sdk version 23 why ? help me :-(
     
  8. Erel

    Erel Administrator Staff Member Licensed User

    Please start a new thread for this and make sure to post the full error message from the logs.
     
Thread Status:
Not open for further replies.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice