R rworner Member Licensed User Longtime User Sep 20, 2013 #1 I want to display a toast message while searching for the ethernet connection. Then after a 3 seconds display a second toast message - either connection found or no connection. Instead of that occurring it appears to skip the first toast message. Attachments testconnection.zip testconnection.zip 6.9 KB · Views: 309 Last edited: Sep 21, 2013
I want to display a toast message while searching for the ethernet connection. Then after a 3 seconds display a second toast message - either connection found or no connection. Instead of that occurring it appears to skip the first toast message.
Eric H Active Member Licensed User Longtime User Sep 21, 2013 #2 can you please edit your post and re-paste your code inside code tags? It is much easier to try and help you when the code is easier to follow. I would recommend re-copying it from your IDE code window so you preserve the indents as well. you can either use the code button on the forum formatting toolbar, or you can use the standard [ CODE][ /CODE] tags (remove spaces). Upvote 0
can you please edit your post and re-paste your code inside code tags? It is much easier to try and help you when the code is easier to follow. I would recommend re-copying it from your IDE code window so you preserve the indents as well. you can either use the code button on the forum formatting toolbar, or you can use the standard [ CODE][ /CODE] tags (remove spaces).
NJDude Expert Licensed User Longtime User Sep 21, 2013 #3 This is a bad way to create a pause in Android: Code: Copy 'delay to give device time to setup connection s = DateTime.now Do While DateTime.now < s+3000 Loop You should be using a TIMER, however, if you want to use that "bad" code add a DoEvents inside the Loop. Upvote 0
This is a bad way to create a pause in Android: Code: Copy 'delay to give device time to setup connection s = DateTime.now Do While DateTime.now < s+3000 Loop You should be using a TIMER, however, if you want to use that "bad" code add a DoEvents inside the Loop.
R rworner Member Licensed User Longtime User Sep 21, 2013 #4 If I changed it to a timer would I need to put all of the code below that point into the timer so that it would not execute until the timer was activated? (Still trying to figure out how all of this works compared to linear programming...) Upvote 0
If I changed it to a timer would I need to put all of the code below that point into the timer so that it would not execute until the timer was activated? (Still trying to figure out how all of this works compared to linear programming...)
NJDude Expert Licensed User Longtime User Sep 21, 2013 #5 Yes, you will do what you need in the timer's TICK event. And please use the [code] ... [/code] tags or attach your project. Upvote 0
Yes, you will do what you need in the timer's TICK event. And please use the [code] ... [/code] tags or attach your project.
NJDude Expert Licensed User Longtime User Sep 21, 2013 #6 Look at the attached sample. Attachments ImprovedSample.zip ImprovedSample.zip 6.8 KB · Views: 306 Upvote 0
R rworner Member Licensed User Longtime User Sep 21, 2013 #7 NJDude said: Yes, you will do what you need in the timer's TICK event. And please use the [code] ... [/code] tags or attach your project. Click to expand... How do I do that? I just copied and pasted from the IDE. NJDude said: Look at the attached sample. Click to expand... Thanks for the assistance. My coding so far is designed to see if my understanding of B4A works as I expect. I do small sections separately to make sure they work then piece them all together. A hold over from my "modular" programming days. The concept I am not grasping in this example is why did the first Toast message: ToastMessageShow("Searching for Ethernet Connection...", True) not appear on the screen, but it proceeded to the Toast message located in the later IF statement and displayed the correct message based on if the ethernet connection was connected or not. Upvote 0
NJDude said: Yes, you will do what you need in the timer's TICK event. And please use the [code] ... [/code] tags or attach your project. Click to expand... How do I do that? I just copied and pasted from the IDE. NJDude said: Look at the attached sample. Click to expand... Thanks for the assistance. My coding so far is designed to see if my understanding of B4A works as I expect. I do small sections separately to make sure they work then piece them all together. A hold over from my "modular" programming days. The concept I am not grasping in this example is why did the first Toast message: ToastMessageShow("Searching for Ethernet Connection...", True) not appear on the screen, but it proceeded to the Toast message located in the later IF statement and displayed the correct message based on if the ethernet connection was connected or not.
NJDude Expert Licensed User Longtime User Sep 22, 2013 #8 How do I do that? I just copied and pasted from the IDE. Click to expand... You HAVE to type those tags BEFORE pasting your code. The concept I am not grasping in this example is why did the first Toast message: ToastMessageShow("Searching for Ethernet Connection...", True) not appear on the screen Click to expand... The reason is due to the way you were creating that "pause", that prevents the main thread to update the UI, as I explained before, that's a bad way to program in Android. Upvote 0
How do I do that? I just copied and pasted from the IDE. Click to expand... You HAVE to type those tags BEFORE pasting your code. The concept I am not grasping in this example is why did the first Toast message: ToastMessageShow("Searching for Ethernet Connection...", True) not appear on the screen Click to expand... The reason is due to the way you were creating that "pause", that prevents the main thread to update the UI, as I explained before, that's a bad way to program in Android.