Android Question How to use BBCodeView properly

Makumbi

Well-Known Member
Licensed User
Please help me out i tried several examples including Erel Chat example but iam failing to get this right i wanted the message to appear in a BBCodeView in the customlistview as it is in the chat example please help me out

B4X:
Sub spnFirstName_ItemClick (Position As Int, Value As Object)
    Dim bitmaps As List = Array("images2.jpg","images2.jpg")
    'smiley = LoadBitmapResize(File.DirAssets, "smiley.png", 24dip, 24dip, False)
    cursor1 = Starter.SQL1.ExecQuery("SELECT Sms,Datesent,Category FROM Sentmessages")
    If cursor1.RowCount > 0 Then
        For i = 0 To cursor1.RowCount-1
            cursor1.Position = i
            Dim Phoneg As String
            Dim Phonegb As String
            Dim senderb As String
            Phoneg =cursor1.Getstring("Sms")
            Phonegb =cursor1.Getstring("Datesent")
            senderb=cursor1.Getstring("Category")
            'Log(Phoneg)
            If Phoneg=Null Then
                Return
            End If
            Log(i)
            
            Dim content As String = Phoneg
            Log(content)
        CLV1.Add(CreateItem(CLV1.AsView.Width, $"Anouncement #${i}"$, bitmaps.Get(0), content &":"& Phonegb,senderb), Phonegb)
        '    CLV1.AddTextItem($"Item ${i}"$, "")
            'CLV1.Add(p, Null)
        Next
    End If
End Sub


i wanted the out put to be like this
Screenshot_1586205058.png



B4X:
Private Sub CreateItem(Width As Int, Title As String, Image As String, Content As String,senderx As String) As Panel
    Dim p As B4XView = xui.CreatePanel("")
    Dim height As Int = 280dip
    If GetDeviceLayoutValues.ApproximateScreenSize < 4.5 Then height = 310dip
    p.SetLayoutAnimated(0, 0, 0, Width, height)
    p.LoadLayout("Card2")
    
    lblTitle.Text = Title
    lblContent.Text = Content
    Label1.Text= senderx
    'SetColorStateList(lblContent, xui.Color_Red,lblContent.TextColor)
    SetColorStateList(lblAction1, xui.Color_LightGray, lblAction1.TextColor)
    SetColorStateList(lblAction2, xui.Color_LightGray, lblAction2.TextColor)
    ImageView1.SetBitmap(xui.LoadBitmapResize(File.DirAssets, Image, ImageView1.Width, ImageView1.Height, True))
    ScrollToLastItem
    Return p

End Sub

my design views

sampleimage.png
 

Attachments

  • Screenshot_1586204447.png
    Screenshot_1586204447.png
    66 KB · Views: 109
Top