help with widget

electronik54

Member
Licensed User
Longtime User
:sign0104:
i am making a widget. heres the code.

B4X:
Sub Process_Globals

   Dim rv As RemoteViews

End Sub
Sub Service_Create
   
   rv = ConfigureHomeWidget("emergencywidget","rv",0,"F.A.I.T.H Emergency Widget",False)

End Sub
Sub EmergencyWidget_btn_click
   
   If File.Exists(File.DirDefaultExternal, "userdata.db") = False Then
   ToastMessageShow("Please Log into F.A.I.T.H and provide Emergency numbers.(GOTO Setting to enter emergency number)",False)

   Else
   StartActivity("startemergency")
   End If

End Sub
Sub Service_Start (StartingIntent As Intent)
   If rv.HandleWidgetEvents(StartingIntent) Then Return
End Sub

Sub Service_Destroy

End Sub

WHY is nothing happening when EmergencyWidget_btn_click????
please rectify the code if you can.
 
Last edited:

tunderin

Member
Licensed User
Longtime User
Hi,

I'm presuming that the button in your layout is named EmergencyWidget_btn. If not, use the exact button name before _click

Minimally, you should add rv.UpdateWidget right after your ConfigureHomeWidget

Good luck...
 
Upvote 0

electronik54

Member
Licensed User
Longtime User
Hi,

I'm presuming that the button in your layout is named EmergencyWidget_btn. If not, use the exact button name before _click

Minimally, you should add rv.UpdateWidget right after your ConfigureHomeWidget

Good luck...

thanks:icon_clap: that worked:sign0060:
 
Upvote 0
Top