Hi,
I have a complex client/server app that I'm not sure I can share the entire code with but happy to do a zoom with someone to show them what is happening.
The server side sends a packet of data that contains everything to draw the GUI on the screen - this includes labels and edit text fields.
All of the edit texts are given a tag with their field name for me to keep track of.
This is a rough idea of how the program works:
1. Packet comes in from server
2. I remove all existing views
3. Process the packet and re-draw based on the new screen
4. I run a "clean up" sub that does some things (this is important is I iterate through the edittextfields on the screen here - when this happens - "FieldSecond" is present, but nothing else)
5. The LAST thing that happens is the textchanged event is being triggered, BUT it's for a edit text field that was on the "last" screen (based on the tag value).
6. User enters data - I send packet to server and when it responds the process starts over again
BUG? part:
So - app starts:
Screen is drawn with edittext lets call it "FieldFirst"
User enters text into that field - I store it in a map based on textchanged event
User hits enter - field sent to server, processed, server sends back a new packet
All views removed
New views drawn
FieldFirst is triggering a textchanged event AFTER a time where I itterate through all edittexts and it no longer exists....
This is a problem - because my code stores this value in a map - and when the user hits enter again I'm sending back to the server a value for a field that should not be on the screen.
My current workaround is:
In the edittext_textedchanged event code I iterate through all edittexts, if the tag of the sender matches the tag of a current field, I let it update the map, otherwise I skip
I can't understand why the event is triggering - bug?
I have a complex client/server app that I'm not sure I can share the entire code with but happy to do a zoom with someone to show them what is happening.
The server side sends a packet of data that contains everything to draw the GUI on the screen - this includes labels and edit text fields.
All of the edit texts are given a tag with their field name for me to keep track of.
This is a rough idea of how the program works:
1. Packet comes in from server
2. I remove all existing views
3. Process the packet and re-draw based on the new screen
4. I run a "clean up" sub that does some things (this is important is I iterate through the edittextfields on the screen here - when this happens - "FieldSecond" is present, but nothing else)
5. The LAST thing that happens is the textchanged event is being triggered, BUT it's for a edit text field that was on the "last" screen (based on the tag value).
6. User enters data - I send packet to server and when it responds the process starts over again
BUG? part:
So - app starts:
Screen is drawn with edittext lets call it "FieldFirst"
User enters text into that field - I store it in a map based on textchanged event
User hits enter - field sent to server, processed, server sends back a new packet
All views removed
New views drawn
FieldFirst is triggering a textchanged event AFTER a time where I itterate through all edittexts and it no longer exists....
This is a problem - because my code stores this value in a map - and when the user hits enter again I'm sending back to the server a value for a field that should not be on the screen.
My current workaround is:
In the edittext_textedchanged event code I iterate through all edittexts, if the tag of the sender matches the tag of a current field, I let it update the map, otherwise I skip
I can't understand why the event is triggering - bug?