Thanks. Been scratching my head, not getting anywhere.
I now get that you can launch the preference screen activity by writing a dedicated activity that will do it for you.
I have made a new activity called 'PreferScr' and pasted all of the code required to launch the preference screen..
Process_Globals
Dim manager As PreferenceManager
Dim screen As PreferenceScreen
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
CreatePreferenceScreen
If manager.GetAll.Size = 0 Then SetDefaults
End If
Sub LaunchPreferenceScr
StartActivity(screen.CreateIntent)
End Sub
etc. etc.
In my service module, on clicking the widget 'button' :
Sub imgSettings_Click
StartActivity(PreferScr)
CallSubDelayed(PreferScr,"LaunchPreferenceScr")
End Sub
And it works!! Hurrah! Is that how it's done?
However, a minor detail:
When I close the preference screen it returns to a blank window and I have to press the back button again, to remove the window. I assume that this blank window is the 'PreferScr' activity still running? So I have put a variable within the 'Sub HandleSettings' to flag that the job has been done and test the flag as follows:
Sub Activity_Resume
If NewSettings Then
Activity.Finish
End If
HandleSettings
End Sub
It works fine but is that the right way to do it?
I feel I'm getting there and hopefully sensibly! Thanks for the life line.