Remote image imageview

future21

Member
Licensed User
Longtime User
Hi all. -

I'm actually quite happy and impressed with B4A. It's more than I expected.

Currently I'm doing and a small application, and although I've been solving all the problems I surgian little PopCo, I come across one that I'm engaged in three days and did not resolve. It is put into a series of images that capture imageviews a remote server. The name of the picture and what I have direcotiro a MySql database on the same server.
HttpUtils2Service am using the class and use the methods:

B4X:
Sub  httpC_ResponseSuccess (Response  As  Http Response , taskId  As  Int ) 
    
    Dim  num  As  Int 
    Dim  res  As  String 
    
    res = Response.GetString ( " UTF8 " ) 
    Log ( " Response from server:  "  & res) 
    Dim  parser  As  JSONParser 
    parser.Initialize (res) 
    Select  taskId 
        Case  CATALOGUE 
            ' add the countries to the ListView 
            Dim  Lista_1  As  List 
            Lista_1 parser.NextArray =  " returns a list with maps 
            NumberOfRows = Lista_1.Size 
            For  i =  0  Thurs  NumberOfRows -  1 
                Dim  m  As  Map 
                m = Lista_1.Get (i ) 
                " We are using a custom type named TwoLines (Declared in Sub Globals). 
                " It Allows us Thurs later get the two values ​​When the user presses are an item. 
                " Dim tl As TwoLines 
                ColumnName ( 0 ) = m.Get ( " nombre " ) 
                ColumnName ( 1 ) = m.Get ( " descrip " ) 
                ColumnName ( 2 ) = m.Get ( " foto " ) 
                " Send a GET request 
                job1.Download (RutaServer & ColumnName ( 2 )) 
                = num i 
                AddRowNew ( ColumnName, num) 
                ' scv1.AddTwoLines2 (tl.First, tl.Second, tl) 
            Next 
            ProgressDialogHide 
        Case  POPULATION 

' ........ Resto cdigo .......... 
End Sub

In RutaServer I have the directory where the image on the server, and ColumnName by the image itself (the name of it).

B4X:
Sub AddRowNew(Values() As String, numPan As Int)
    
    'Dim pnl1 As Panel
    Dim lbl1 As Label
    Dim lbl2 As Label
    Dim img1 As ImageView
    
    'LEFT  TOP  WIDTH  HEIGHT    
    pnl1.Initialize("")
    scv1.Panel.AddView(pnl1,0,numPan*PanelHeight,100%x,PanelHeight)
    pnl1.LoadLayout("components")
    
    lbl1.Initialize("")
    pnl1.AddView(lbl1,10dip, 0dip, 2300dip, 30dip)
    lbl1.TextSize=12
    lbl1.TextColor=Colors.Black
    lbl1.Text = Values(0)
    
    
    lbl2.Initialize("")
    pnl1.AddView(lbl2, 10dip, 30dip, 174dip, 60dip)
    lbl2.TextSize=12
    lbl1.TextColor=Colors.White
    lbl2.Text = Values(1)
    
    img1.Initialize("")
    img1.Bitmap = job1.GetBitmap
    pnl1.AddView(img1,240dip, 0dip, 80dip, 90dip)
        
    scv1.Panel.Height = NumberOfRows * PanelHeight
    
End Sub

This is where the image would load imageview, however, on the line I img1.Bitmap = job1.GetBitmap reports the error:

B4X:
LastException java.lang.RuntimeException: Error loading Bitmap

Ultimately, I also valid on the server, sending my login and password, but still the same error reportándome. 's see if someone can enlighten me because I have some days that do not go out of this loop.

Greetings and thank you very much.
 
Last edited:
Top