-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Labels
unverifiedA bug that has been reported but not verifiedA bug that has been reported but not verified
Description
Checklist
- I have searched the issue tracker for open issues that relate to the same problem, before opening a new one.
- This issue only relates to a single bug. I will open new issues for any other problems.
Describe the bug
When running my application in Android Emulator on Linux, preferences do not get saved.
They get saved running in web mode and as a Desktop application
Android Debug Bridge version 1.0.41
Version 35.0.0-11411520
Running on Linux 6.8.0-88-generic (x86_64)
Android Emulator V36.2.12-14214601
fyne cli version: v1.6.2
fyne library version: v2.7.1
How to reproduce
- Create application
- Uninstall previous version (Make command
${ADB} shell cmd package uninstall -k ${APP_ID}) - Build new version (Make command
export ANDROID_NDK_HOME=${NDK_HOME} && fyne package -os android) - Install new version to emulator (Make command
${ADB} install ${APP_NAME}.apk) - Start app in emulator
- Go to settings screen, enter values and click on save button
- See confirmation dialog that settings have been saved
- Exit app and restart
- Go to settings screen. See that previously entered values have not been saved
Screenshots
No response
Example code
My code contains a Prefs struct (global params variable) which handles all operations for preferences. The prefs.Save() method is called in the OnSubmit callback for the settings screen.
// Save stores the configuration in the preference store
func (cfg *Prefs) Save() {
p := fyne.CurrentApp().Preferences()
p.SetString(awsKey, cfg.AwsAccessKey)
p.SetString(awsSecret, cfg.AwsSecret)
p.SetString(currentInstance, cfg.CurrenInstance)
for i := 0; i < 10; i++ {
slot := fmt.Sprintf("%s%d", "slot", i+1)
p.SetString(fmt.Sprintf("ins%s", slot), cfg.Instances[slot])
p.SetString(fmt.Sprintf("ids%s", slot), cfg.Ids[slot])
p.SetString(fmt.Sprintf("reg%s", slot), cfg.Regions[slot])
}
cfg.Saved = true
} accessKey := binding.NewString()
secretKey := binding.NewString()
if err := accessKey.Set(params.AwsAccessKey); err != nil {
panic(err)
}
if err := secretKey.Set(params.AwsSecret); err != nil {
panic(err)
}
accessKeyItem := widget.NewFormItem("AWS Access Key", widget.NewEntryWithData(accessKey))
secretKeyItem := widget.NewFormItem("AWS Secret Key", widget.NewEntryWithData(secretKey))
form := &widget.Form{
Items: []*widget.FormItem{
accessKeyItem,
secretKeyItem,
},
OnSubmit: func() {
params.Saved = false
v, err := accessKey.Get()
if err == nil {
params.AwsAccessKey = v
}
v, err = secretKey.Get()
if err == nil {
params.AwsSecret = v
}
params.Save()
dialog := dialog2.NewInformation("Success", "Settings saved", myWindow)
dialog.Show()
},
OnCancel: func() {},
SubmitText: "Save",
CancelText: "Cancel",
Orientation: 0,
}Fyne version
2.7.1
Go compiler version
1.23.4
Operating system and version
Ubuntu 24.04.3 LTS
Additional Information
No response
Metadata
Metadata
Assignees
Labels
unverifiedA bug that has been reported but not verifiedA bug that has been reported but not verified