Android Question HttpUtils2 or OkHttpUtils

Status
Not open for further replies.

RUNO

Active Member
Licensed User
Longtime User
If I used HttpUtils2 I can connect database but cannot load image ,but opposite if I used OkHttpUtils download but not connect .
I want read data from remote db and download image from website .
Any one help me
 

RUNO

Active Member
Licensed User
Longtime User
I used OkHttpUtils but all not success
If I used OkHttpUlits I can download image but can't connect ,HttpUlit2 oppesite
this is a part from code

B4X:
Dim link As String="https://xxxxxxxxxhostapp.com/picf/g.png"
    Dim job1 As HttpJob
    job1.Initialize("j", Me)
    job1.Download(link)
    
    JobDone(job1)
    
    Dim job2 As HttpJob
    job2.Initialize("j0", Me)
    job2.Download("https://xxxxxxxhostapp.com/" &"part.php")
    
    JobDone(job2)
End Sub
Sub JobDone(job As HttpJob)
    If job.JobName="j" Then
   If job.Success Then
     ImageView1.Bitmap=job.GetBitmap
   Else
     Log("Error: " & job.ErrorMessage)
   End If
Else If job.JobName="j0" Then
    If job.Success=True Then
    Dim strReturn As String = job.GetString
    Dim parser As JSONParser
    parser.Initialize(strReturn)
    Dim L0 As List
    L0 = parser.NextArray 'returns a list with maps
            Log(L0.Size)
    If L0.Size >0 Then
        For i = 0 To  L0.Size-1
        
            Dim m As Map
            m = L0.Get(i)
            Log(m.Get("p_name"))
            End If
            Next
    ............
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
1) Use OkHttpUtils2. Hardly anyone will help you out on HttpUtils issues. So if you want some help, use OkHttpUtils2
2)
Never use HttpUtils2.

If you are unable to download with OkHttpUtils2 then start a new thread and explain the problem.
 
Upvote 0

RUNO

Active Member
Licensed User
Longtime User
1) Use OkHttpUtils2. Hardly anyone will help you out on HttpUtils issues. So if you want some help, use OkHttpUtils2
2)

I used OkHttpUtils2 for download image, it is success but for connect db didn't success

How I use it for both ?
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
If I used HttpUtils2 I can connect database but cannot load image ,but opposite if I used OkHttpUtils download but not connect
I used OkHttpUtils2 for download image, it is success but for connect db didn't success

I’m a tad confused. One time OkHttpUtils2 can, another time can’t connect. Either way though, without any logs, it’s hard to say why you are having no success. Also, you should be using Wait For when using OkHttpUtils2. See https://www.b4x.com/android/forum/threads/b4x-okhttputils2-with-wait-for.79345/. Finally, this should be handled with a new thread, as per @Erel’s request, since the initial question for this thread has been answered.
 
Upvote 0

RUNO

Active Member
Licensed User
Longtime User
Simply, I want to read data from db and view images from the site, so how
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
Simply, I want to read data from db and view images from the site, so how
If you are unable to download with OkHttpUtils2 then start a new thread and explain the problem.
If you do that (create a new thread) ,restrict your problem to OkHttpUtils2 and include a) code b) error messages (if any - client and or server side) and, if possible (and mentioned by @DonManfred ) a small sample application that has the issue, then I and most likely others will take a look at your problem
 
Last edited:
Upvote 0
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…