Android Question Widget Layout Problem

peggjones

Active Member
Licensed User
Longtime User
I have created a layout for a widget. It has the required panel with a label in it. When the widget is displayed the Label is not displayed and an attempt to update throws an "Field not defined". An update to an ImageView works OK. I cannot for the life of find what's going on. The layout definitely has a view named label1.


This is the error "java.lang.RuntimeException: java.lang.NoSuchFieldException: widget99_label1"

Many thanks in advance to anyone who can help.

Here is the code -

Widget:
Sub Process_Globals
    Dim rv As RemoteViews
End Sub

Sub Service_Create
   
    rv = ConfigureHomeWidget("Screen", "rv", 30, "My Own Image", True)
   
End Sub

Sub Service_Start (StartingIntent As Intent)
    rv.HandleWidgetEvents(StartingIntent)
    Sleep(0)
    Service.StopAutomaticForeground
    Scrivi
End Sub

Sub rv_RequestUpdate
    rv.UpdateWidget
End Sub

Sub rv_Disabled
    StopService("")
End Sub

Sub Service_Destroy

End Sub

Sub Scrivi
   
   
    rv.SetImage("ImageView1", LoadBitmap(File.DirAssets, "poker-chips.png"))   
    Sleep(100)
    rv.UpdateWidget

    rv.Settextcolor("label1", Colors.red)
    Sleep(100)

    rv.updatewidget

End Sub

Sub label1_Click
    rv.UpdateWidget
End Sub
 
Last edited:

Brian Dean

Well-Known Member
Licensed User
Longtime User
If it is a B4XPages project, look at the top of the main page ...

B4X:
'Ctrl + click to export as zip: ide://run?File=%B4X%\Zipper.jar&Args=Project.zip

Otherwise, look on the "File..." menu - fourth item.

Then attach the zip file to your next post.
 
Upvote 0
Top