Launch Your First Android app with our TOP course at 82% OFF (24 hrs ONLY) HERE https://goo.gl/7veBXc
“Learn How To Design + Code A Complete App From Scratch To Playstore”
➨ https://www.youtube.com/watch?v=aWGGZCOHZ1k
-~-~~-~~~-~~-~-
This Android Tutorial video shows an example of Looper in Android. Looper is associated with a thread when you call Looper.prepare() and when you invoke Looper.loop() you process messages from the message queue of that thread. Main Thread can send Runnable or Message objects to background thread once the background thread has an associated Looper
OUR WEBSITE
http://slidenerd.com
OUR SOCIAL LINKS
https://www.facebook.com/groups/AndroidProgramming/
Follow us on
http://google.com/+slidenerd
http://facebook.com/slidenerd
Tweets by slidenerdtech
http://pinterest.com/slidenerd
source
Thank you so much
if i want to trigger a fragment by MainActivity to rotate images using handler sendMessage….how to do this
Hi Vivek, do we need to create a looper , when we send message from background thread to main thread? Since in the last video you didn't prepare the looper
Thank you so much..
you must update your videos alot of method deprecated ):
When i type inside the method OnClick, the system doesn't find "handler" while i write "myThread.handler.post…"
I use buttonName.setOnClickListener(…) inside my OnCreate for handle the event OnClick, is this make a difference?
Hi vivz …. I have doubt . Do main thread have there on looper ?
Thanks for teaching us. Youtube must put extra rating options for tutorials and scientific contents and of course more budget for them.
please upload some videos on services in android and how they work also how to send data from services to activity or services to services and stuff like that.
More than awesome..
For the record, it won't work with a runnable, you gotta extend Thread
it will work for send message from one Android mobile to another Android mobile using wifi.
Hi slidenerd.
Please can you mention the certain issues with this code. I'm interested to know about it.
Why do you have to create a new Handler in the run method and not in the constructor?? does that mean a new Handler must be created each time you post a Runnable on the worker thread? why?
hi @slidenerd
does the main thread have a looper by default?
I mean if the message is to be sent from other thread to main thread then do we have to write Load.prepare() in the main thread?
I guess in the previous vid,you did not use Looper.prepare() in the main thread when the message was to be transferred from other thread to main thread.
does the main thread have a looper by default?
I mean if the message is to be sent from other thread to main thread then do we have to write Load.prepare() in the main thread?
Hi vivz,
Great video but how come we didn't have to create a looper in our main activity, so that our main class can have and manage a message queue?
Looper.prepare ();
handler= new handler();
Looper.loop();
Hey Vivz I a appreciate if you can share more light of how the (Looper) bind with the (handler)?
One little hint on this – be sure to import the correct Handler class – the "import java.util.logging.Handler;" won't work, you want "import android.os.Handler;" – which was the second on my list to import.
Hi Vivz, does the run() method run asynchronously of the main thread when you say myThread.start()? The reason I ask, say there was a long method call at the beginning of run() (like Thread.sleep(5000)), and then immediately after you call myThread.start() you were to call sendMessage(), would myThread.handler still be null and therefore result in NRE? So my follow up question, if that is the case, is there a way to test whether the thread is prepared to accept messages or not?
Do you have or recommend any tutorial that I can connect Android App with MySql database?