I have an app that is about Reminders. On my Main activity, I have a button that let's the user enter a new Reminder. I would use a CustomDialog, but that doesn't let me use the entire width of the screen.
So, I created another Activity called EditReminder. I can pass the ID of the database object that represents the Reminder in by using Process_Global variables. In my example, I am passing in a -1 to indicate I am adding a new Reminder.
So, I use this code:
After the activity is complete, I would hope to get the values back, but I don't know how to make this happen. Will the second activity return control to the code after StartActivity? How do I exit the EditReminder activity to make it return to right after it was called?
Here is some code from the EditReminder activity:
So, I created another Activity called EditReminder. I can pass the ID of the database object that represents the Reminder in by using Process_Global variables. In my example, I am passing in a -1 to indicate I am adding a new Reminder.
So, I use this code:
B4X:
EditReminder.EditedReminderID = -1
StartActivity("EditReminder")
' Hoping I can access data from the EditReminder acivity now
After the activity is complete, I would hope to get the values back, but I don't know how to make this happen. Will the second activity return control to the code after StartActivity? How do I exit the EditReminder activity to make it return to right after it was called?
Here is some code from the EditReminder activity:
B4X:
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Type Reminder(Description As String, When As String, Trigger As String, PlaceID As Int, DaysOfWeek As List, StartTimeWindowHours As Int, StartTimeWindowMinutes As Int, StopTimeWindowHours As Int, StopTimeWindowMinutes As Int)
'When = { The next time, Any time }
'Trigger = { I Arrive at, I Depart from }
'DaysOfWeek is a list of Booleans starting with Sunday as DaysOfWeek[0]
'onSunday= d.Get(0) <> 0
'onMonday= d.Get(1) <> 0
'onTuesday= d.Get(2) <> 0
'onWednesday= d.Get(3) <> 0
'onThursday= d.Get(4) <> 0
'onFriday= d.Get(5) <> 0
'onSaturday= d.Get(6) <> 0
Dim EditedReminder As Reminder
Dim EditedReminderID As Int
End Sub
Sub Activity_Pause (UserClosed As Boolean)
' Save the values from the view on the screen in a global object of type Reminder called EditedReminder
Dim r As Reminder
r.Initialize()
r.Description = EditName.Text
r.When = ""
r.Trigger = SpinTrigger.SelectedItem
r.PlaceID = GetPlaceIDFromSpinPlaces
r.StartTimeWindowHours = EditStartHour.Text
r.StartTimeWindowMinutes = EditStartMinute.Text
r.StopTimeWindowHours = EditStopHour.Text
r.StopTimeWindowMinutes = EditStopMinute.Text
EditedReminder = r
StartActivity("Main")
End Sub