R rafaelmotaquintana Active Member Licensed User Jul 24, 2016 #1 I have this situation. This Sub gets an edittext as a parameter, and I need to know after an activity resume, which edittext was used Code: Copy Sub SaveSettings(lText As EditText) StateManager.SetSetting("bigtext",lText.Text) End Sub After an activity resume, I need to restore the original edittext, and I don't know which is. If only I could save the name of the edittext or some reference.
I have this situation. This Sub gets an edittext as a parameter, and I need to know after an activity resume, which edittext was used Code: Copy Sub SaveSettings(lText As EditText) StateManager.SetSetting("bigtext",lText.Text) End Sub After an activity resume, I need to restore the original edittext, and I don't know which is. If only I could save the name of the edittext or some reference.
KMatle Expert Licensed User Longtime User Jul 24, 2016 #2 Just set lText.tag=xxxxx before. The you can check the value later. Upvote 0
R rafaelmotaquintana Active Member Licensed User Jul 24, 2016 #3 I can't, its been used for another purposes. Besides, there are a lot of them and some are created in code, others are from layouts. Upvote 0
I can't, its been used for another purposes. Besides, there are a lot of them and some are created in code, others are from layouts.
Erel B4X founder Staff member Licensed User Longtime User Jul 24, 2016 #4 You have two options: 1. Use a custom type that holds all the things you need and set it as the Tag value. 2. Create a Map with the EditTexts as keys: Code: Copy Dim EditTextNames As Map = CreateMap(EditText1: "EditText1", EditText2: "EditText2") Dim name As String = EditTextNames.Get(et) 'et is an unknown EditText Upvote 0
You have two options: 1. Use a custom type that holds all the things you need and set it as the Tag value. 2. Create a Map with the EditTexts as keys: Code: Copy Dim EditTextNames As Map = CreateMap(EditText1: "EditText1", EditText2: "EditText2") Dim name As String = EditTextNames.Get(et) 'et is an unknown EditText
R rafaelmotaquintana Active Member Licensed User Jul 24, 2016 #5 The first options is the one I prefer, but StateManager.SetSetting only saves string. If I could save the object, then after activity resume I could use SAVEDEDITTEXT = StateManager.getsetting(something) SAVEDEDITTEXT.TEXT = StateManager.SetSetting("savedtext") Upvote 0
The first options is the one I prefer, but StateManager.SetSetting only saves string. If I could save the object, then after activity resume I could use SAVEDEDITTEXT = StateManager.getsetting(something) SAVEDEDITTEXT.TEXT = StateManager.SetSetting("savedtext")
Erel B4X founder Staff member Licensed User Longtime User Jul 25, 2016 #6 You cannot persist views. Upvote 0