J junaidahmed Well-Known Member Licensed User Longtime User Mar 12, 2018 #1 I have four EditText in my Layout.I have updated the value in four EditText.When I rotate Screen,the data of all four EditText has reset.Please check attached layout File and advise the same... I have tried StateManager also but I have not solved this problem.... Code: Copy Sub Activity_Pause (UserClosed As Boolean) If UserClosed Then StateManager.ResetState("Main") Else StateManager.SaveState(Activity, "Main") End If StateManager.SaveSettings End Sub Attachments dairy_layout.bal dairy_layout.bal 7.5 KB · Views: 471
I have four EditText in my Layout.I have updated the value in four EditText.When I rotate Screen,the data of all four EditText has reset.Please check attached layout File and advise the same... I have tried StateManager also but I have not solved this problem.... Code: Copy Sub Activity_Pause (UserClosed As Boolean) If UserClosed Then StateManager.ResetState("Main") Else StateManager.SaveState(Activity, "Main") End If StateManager.SaveSettings End Sub
DonManfred Expert Licensed User Longtime User Mar 12, 2018 #2 if you leave your app using the Backkey the settings are resetted (UserClosed is true) Upvote 0
J junaidahmed Well-Known Member Licensed User Longtime User Mar 12, 2018 #3 No, I just Rotate the Screen Orientation Upvote 0
DonManfred Expert Licensed User Longtime User Mar 12, 2018 #4 Check the value of UserClosed with LOG Upvote 0
J junaidahmed Well-Known Member Licensed User Longtime User Mar 12, 2018 #5 Please check the below log Logger connected to: LENOVO Lenovo A2010-a --------- beginning of main --------- beginning of system ** Activity (main) Create, isFirst = true ** autoversion: 582.0 compilation time: 03/12/2018 11:51:23 ** Activity (main) Resume ** ** Activity (main) Pause, UserClosed = false ** ** Activity (main) Create, isFirst = false ** WakeLock already held. autoversion: 582.0 compilation time: 03/12/2018 11:51:23 ** Activity (main) Resume ** Upvote 0
Please check the below log Logger connected to: LENOVO Lenovo A2010-a --------- beginning of main --------- beginning of system ** Activity (main) Create, isFirst = true ** autoversion: 582.0 compilation time: 03/12/2018 11:51:23 ** Activity (main) Resume ** ** Activity (main) Pause, UserClosed = false ** ** Activity (main) Create, isFirst = false ** WakeLock already held. autoversion: 582.0 compilation time: 03/12/2018 11:51:23 ** Activity (main) Resume **
Erel B4X founder Staff member Licensed User Longtime User Mar 12, 2018 #6 Try to reproduce it in a small project and upload it. Upvote 0
J junaidahmed Well-Known Member Licensed User Longtime User Mar 12, 2018 #7 Please download my project from below link https://www.dropbox.com/s/gfwgwjko1lgkiba/Cabinet.rar?dl=0 Upvote 0
Please download my project from below link https://www.dropbox.com/s/gfwgwjko1lgkiba/Cabinet.rar?dl=0
Erel B4X founder Staff member Licensed User Longtime User Mar 12, 2018 #8 Going over a large project is difficult. You should reproduce it in a small project. Upvote 0
J junaidahmed Well-Known Member Licensed User Longtime User Mar 12, 2018 #9 For your Reference I am attaching the SQlite Data also... https://www.dropbox.com/s/r5knr7spdeiobsh/Data.rar?dl=0 Upvote 0
For your Reference I am attaching the SQlite Data also... https://www.dropbox.com/s/r5knr7spdeiobsh/Data.rar?dl=0
J junaidahmed Well-Known Member Licensed User Longtime User Mar 12, 2018 #10 As per your request,Here I am attaching small project which contain only one layout.... Attachments StateManager.zip StateManager.zip 463.9 KB · Views: 500 Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Mar 12, 2018 #11 1. See the warnings. You cannot show Msgbox from Activity_Pause. 2. Don't use Msgbox at all. Use Log instead. See the debugging tutorial. 3. Your layout is wrong. There should never be two views anchored to BOTH on the same horizontal or vertical line. See the visual designer tutorial: https://www.b4x.com/etp.html 4. You are not using StateManager correctly. See the tutorial: https://www.b4x.com/android/forum/t...applications-settings-and-state.9777/#content You should restore the state in Activity_Create. 5. Please use File - Export as zip when you upload projects to the forum. Upvote 0
1. See the warnings. You cannot show Msgbox from Activity_Pause. 2. Don't use Msgbox at all. Use Log instead. See the debugging tutorial. 3. Your layout is wrong. There should never be two views anchored to BOTH on the same horizontal or vertical line. See the visual designer tutorial: https://www.b4x.com/etp.html 4. You are not using StateManager correctly. See the tutorial: https://www.b4x.com/android/forum/t...applications-settings-and-state.9777/#content You should restore the state in Activity_Create. 5. Please use File - Export as zip when you upload projects to the forum.
J junaidahmed Well-Known Member Licensed User Longtime User Mar 12, 2018 #12 Thanks for above points.... As per your request, I have restore "State" in "Activity_Create" Event..... It works fine as per my requirement, but why "Runtime view not saved" ??? , Actually I have used "GallaryView" in runtime but When I restore "State" ,the Gallaryview not updated..... Upvote 0
Thanks for above points.... As per your request, I have restore "State" in "Activity_Create" Event..... It works fine as per my requirement, but why "Runtime view not saved" ??? , Actually I have used "GallaryView" in runtime but When I restore "State" ,the Gallaryview not updated.....
DonManfred Expert Licensed User Longtime User Mar 12, 2018 #13 junaidahmed said: Actually I have used "GallaryView" in runtime but When I restore "State" ,the Gallaryview not updated..... Click to expand... Erel said: Not all the elements are saved. Only elements which the user interacts with (like EditText text, Spinner chosen item, SeekBar value...). Click to expand... !!! Upvote 0
junaidahmed said: Actually I have used "GallaryView" in runtime but When I restore "State" ,the Gallaryview not updated..... Click to expand... Erel said: Not all the elements are saved. Only elements which the user interacts with (like EditText text, Spinner chosen item, SeekBar value...). Click to expand... !!!
J junaidahmed Well-Known Member Licensed User Longtime User Mar 12, 2018 #14 Actually I have Added 3 Thumbnail Image in Gallaryview.... So, It is not possible to use "SaveState" for 3 Image in GallaryView ??? Upvote 0
Actually I have Added 3 Thumbnail Image in Gallaryview.... So, It is not possible to use "SaveState" for 3 Image in GallaryView ???
DonManfred Expert Licensed User Longtime User Mar 12, 2018 #15 Statemanager does not save any images showing in galleryview. See the statement i quoted Upvote 0
J junaidahmed Well-Known Member Licensed User Longtime User Mar 12, 2018 #16 ok Noted with Thanks.... Upvote 0
J junaidahmed Well-Known Member Licensed User Longtime User Mar 12, 2018 #17 For Alternate solution Can I use SaveSetting And GetSetting for this ??? Upvote 0
DonManfred Expert Licensed User Longtime User Mar 12, 2018 #18 Images in the Galleryview ARE NOT Saved! Even not with SaveSetting. Did i miss something? Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Mar 12, 2018 #19 junaidahmed said: For Alternate solution Can I use SaveSetting And GetSetting for this ??? Click to expand... The main question in this thread was answered. For any other question you should start a new thread. Upvote 0
junaidahmed said: For Alternate solution Can I use SaveSetting And GetSetting for this ??? Click to expand... The main question in this thread was answered. For any other question you should start a new thread.