PROFESSIONAL NEWSGROUPS
WINDEV
,
WEBDEV
and
WINDEV Mobile
Home
|
Recent messages
|
Connect
|
Sign out
|
English
Home
→
WINDEV 2024
→
Android Fatal Thread Problem
Android Fatal Thread Problem
Started by John Fligg, Dec., 12 2017 3:09 PM - 4 replies
Connect yourself…
John Fligg
#1
Posted on December, 12 2017 - 3:09 PM
This ONLY happens with Android. Same code runs on iOS and Windows. Running on an Android A5.
I start a thread:
ThreadExecute("Validate", threadNormal, ValidateLogin)
In the local ValidateLogin procedure I issue this:
STC_ProgMessage = "Logging in Online ..."
RequestUpdateUI()
I have also tried ExecuteUpdateUI()
However, only in Android I get this fatal error message:
"Only the original thread that created a view hierarchy can touch its views"
Yet RequestUpdateUI() attempts to refresh the window in the original thread. If it works in Windows and iOS why not Android but more importantly how do I fix this. It appears to be a Fatal error.
Thx to anyone who can help.
Report
0
0
Fabrice Harari
#2
Posted on December, 12 2017 - 3:36 PM
Hi John,
from it's prefix, I'm gathering that STC_ProgMessage is a static FIELD in your window.
An that means that you are trying to mess with the UI from inside a secondary thread.
And that, as explained CLEARLY in the threads help, is a BIG NO NO.
Store your value in a variable, NOT a field, and then your local to the window update code that put that value in a field. Or use the tExecuteMainThread function and pass the value as parameter to a local function that will do the display...
If it currently works in iOS, but SURE that at some point you'll end up with unexplained 'random' errors.... Coming straight from there.
Best regards
Report
0
0
John Fligg
#3
Posted on December, 12 2017 - 3:53 PM
Oh thank you Fabrice. I will read the help again. I am sure it said the idea of RequetUpdateUI() was to overcome this exact issue and to be able to update UI in the original thread. I didn't see any mention of variables. Thx.
Report
0
0
John Fligg
#4
Posted on December, 12 2017 - 4:25 PM
Thank you so much once again Fabrice. I still don't think the help made it that clear first time. Re reading it and it seems "implied" what to do.
Anyway I used ExecuteMainThread and it seems to work other than the same failure later in the process so will check that out.
Very much appreciated.
John
Report
0
0
Fabrice Harari
#5
Posted on December, 12 2017 - 4:53 PM
requestUpdateUI does exactly what is says and is NOT the problem
The problem is the line BEFORE it, where you put by code a value in a field of your UI... THAT is forbidden.
Report
0
0
→ Go back to WINDEV 2024
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (earlier versions)
Français
English
Español
Portuguesa
Close this window
Search type
Only topics
All the messages
Search period
Any time
Past hour
Past 24 hours
Past week
Past month
Past year
Cancel
Preview of your message
Adding an image
Import an image from a URL
Send an image from a file of your disk
Drop a file or click "Browse..."
or
Cancel
0%
WLanguage
SQL
XML, HTML
JAVA, Javascript
Text