Android Question Make Preferences Dialog Modal

Cosmo

Member
Hello all,
didn't find a solution here for this:

Is it possible to make a Preferences Dialog modal, so the program stopps while the user puts in data, and returns to the code after Ok or Cancel is pressed?

How would this be implemented?

Thanks in advance!

Regards,
Bernhard
 

Cosmo

Member
Thanks for reading this,
after browsing the documentation I found for me following solution.

Regards
Bernhard

B4X:
 ...
    OpenConfiguration
    Wait For OpenConfiguration_Complete
 ...
   
   
Sub OpenConfiguration
    pfdialog.LoadFromJson(File.ReadString(File.DirAssets,"prefs.json"))
    Wait For (pfdialog.ShowDialog(PrefData, "OK", "CANCEL")) Complete (Result As Int)
    If Result = xui.DialogResponse_Positive Then
        Dim ser As B4XSerializator
        File.WriteBytes(xui.DefaultFolder,PrefsFile,ser.ConvertObjectToBytes(PrefData))
    End If

    CallSubDelayed(Me, "OpenConfiguration_Complete")
       
End Sub
 
Upvote 0
Top