Android Question open image in clv

qey

Member
I have this customlistview where it display the image of the item(screnshoot shown below) and when user click the image it will enlarge it. Right now it only display the last picture that have in the clv, not the specific image of the clv row. So i need help on how to make the image displayed when user click to the specific clv row. Thank you everyone
1659321046523.png
 

qey

Member
here is the code
B4X:
Private Sub CreateStatus(Width As Int, Image_Proof As String) As Panel
    Dim p As B4XView = xui.CreatePanel("")
    Dim height As Int = 90dip
    p.SetLayoutAnimated(0, 0, 0, Width, height)
    p.LoadLayout("StatusDetails")
   
    If Image_Proof = "" Then
        lblProof.Visible = False
        imgProof.Visible = False
    Else
        imgProof.Bitmap = Base64EncodeDecodeImage.Base64StringToImage(Image_Proof)
        DownloadAndSetImage(Image_Proof)
    End If
   
    Return p
End Sub

Private Sub clvStatusList_ItemClick (Index As Int, Value As Object)
    clvClick = True
   
    DownloadAndSetImage(pic)
End Sub

Private Sub DownloadAndSetImage(ImgView As String)
    pic = ImgView
   
    If clvClick = True Then
        Dim pnl As B4XView = xui.CreatePanel("")
        pnl.SetLayoutAnimated(0dip, 0dip, 0dip, 250dip, 300dip)
        pnl.LoadLayout("show_photo_dialog")
        pnl.RemoveAllViews
   
        ImageShowLarge.Bitmap = Base64EncodeDecodeImage.Base64StringToImage(pic)
   
        pnl.AddView(ImageShowLarge,0dip,0dip,250dip,300dip)
   
        Dim rsub1 As ResumableSub =  photodialog.ShowCustom(pnl, "OK", "", "")
        Wait For (rsub1) Complete (Result As Int)
        If Result = xui.dialogResponse_Positive Then
            '
        End If
    End If
    clvClick = False
End Sub
 
Upvote 0

qey

Member
1. Where does pic comes from?
2. clvClick isn't handle correctly. It will become false if the user clicks twice.
3. Why are you loading a layout and then removing all views?
1. the pic come from the api server.
2. Oh i see, understand. Thank you for this
3. Sorry my mistake ?
 
Upvote 0
Top