Hi,
I am trying to find a way to handle missing keys in KeyValueStore. I had created a weekly scheduler that worked till the user deleted the file where the schedules were stored.
Perhaps did I not well understood the problem but, it seems to me (unsure) that if I initialize kvs in the Activity_Create, the file is created. So I can not check if file.exists
So I have tried to do a try/catch to be able to populate by default, but, as I have seen, if a key is missing the try/catch doesn't handle the code in the code module, or does it ?
Here is my structure :
keys : string values from 1 to 7 for each day of week
object : a type with two strings for the start time and the end time (HH:MM)
The workaround I have found is to use a Map inside a defined key ("scheduled") to be able to use the GetDefault. But I really wonder if I don't do it too difficult. Perhaps do you have any other solution ?
Thanks
I am trying to find a way to handle missing keys in KeyValueStore. I had created a weekly scheduler that worked till the user deleted the file where the schedules were stored.
Perhaps did I not well understood the problem but, it seems to me (unsure) that if I initialize kvs in the Activity_Create, the file is created. So I can not check if file.exists
So I have tried to do a try/catch to be able to populate by default, but, as I have seen, if a key is missing the try/catch doesn't handle the code in the code module, or does it ?
Here is my structure :
keys : string values from 1 to 7 for each day of week
object : a type with two strings for the start time and the end time (HH:MM)
The workaround I have found is to use a Map inside a defined key ("scheduled") to be able to use the GetDefault. But I really wonder if I don't do it too difficult. Perhaps do you have any other solution ?
Thanks