Android Question Using AnotherDatePicker with StateManager

Ricky D

Well-Known Member
Licensed User
Longtime User
I'd love to know how I code the StateManager to be able to save what date was selected (the bit that looks like an edittext) and also save the ticks value of the date

regards, Ricky
 

Eme Fibonacci

Well-Known Member
Licensed User
Longtime User
1) You can create a method in the AnotherDatePicker class
like this:
B4X:
Public Sub getTimeStamp As String
       Return dateField.Text
End Sub

And then you can get the string using:
B4X:
Sub AnotherDatePicker1_DateChanged (NewDate As Long)
      Log ($ "New date $ Date {NewDate}" $)
      Log (AnotherDatePicker1.TimeStamp)
End Sub

2) (I guess) StateManager saves views values. AnotherDatePicker is a class. It is not a View.
However, you could save and retrieve the value using a invisible label in your activity.
 
Last edited:
Upvote 0

Ricky D

Well-Known Member
Licensed User
Longtime User
all I want is to be able to save those 2 things and get them back if the phone is rotated
 
Upvote 0

Ricky D

Well-Known Member
Licensed User
Longtime User
Testing I found the statemanager works. I'm using v2 of the anotherdatepicker where you place it on the designer so it's a view in the activity. Yesterday it was crashing but now works. The real test is when I give the app to 3 testers to test it out
 
Last edited:
Upvote 0
Top