Android Question BBCodeView error when assigning a text: java.lang.RuntimeException: Object should first be initialized (List).

Hanz

Active Member
Hello,

Erel has a chat example which demonstrates the use of BBCodeView. In the example, BBCodeView is in the same .bal file as the listview. In my case, the BBCodeView is in another .bal file. But every time I assign a value on its text property, I get the above error. I placed the following two codes, which I think have to do with the error, in the B4XPage_Created and in the section where I create the panel which is the cell item of the listview, but the result is the same.

B4X:
TextEngine.Initialize(Root)
bbcMessageContent.TextEngine = TextEngine

I used the above code inside the B4XPage_Created. I also put the above code in the sub where the panel is created as shown below:

B4X:
Private Sub CreateMessage(Width As Int, Height As Int, MessageText As String) As Panel
    Dim panel As B4XView = xui.CreatePanel("")
    panel.SetLayoutAnimated(0, 0, 0, Width, Height)
    panel.LoadLayout("messagecontent")
    TextEngine.Initialize(panel)
    bbcMessageContent.TextEngine = TextEngine
    bbcMessageContent.Text = MessageText
    Return panel
End Sub

I tried to put a value on its text property in the designer and it works. But puting a value on its text property during run time, the above error appears. Any help? Thanks!!!
 

Hanz

Active Member
Thanks erel, I already got it. I actually got it without knowing it, but I did not recognize that the error was already related to the script inside the BBCodeView and has nothing to do with the BBCodeView itself. But your advice on initializing the TextEngine helps. I am initializing it every time. Thanks for informing in advance.

But I have another question on the img script. The documentation you posted assumes that the file is either local or remote without password. What if the remote requires password? We have to use the httpjob right? And use the job.Download()? If that is so, how do we use it inside the img? I tried to use the job.GetBitmap but returns error:
B4X:
ResponseError. Reason: java.net.UnknownHostException: Unable to resolve host "3cba642c": No address associated with hostname, Response:
 
Upvote 0
Top