Football Fans: Download the 2012 Schedule App from Google Play!


Go Back   Android Forums > Android Development > Application Development > Developer 101

Developer 101 101 Tutorials



Reply
 
LinkBack Thread Tools
Old November 26th, 2011, 06:44 AM   #1 (permalink)
New Member
 
Join Date: Nov 2011
Posts: 2
 
Device(s):
Thanks: 1
Thanked 0 Times in 0 Posts
Default Wanna know about Runnable and Handler

Hi All,
I'm newbie to android.and i have some doubts about Handlers and runnable.

1.
Code:
 mHandler.postDelayed(mUpdateTimeTask, 5000);

where mUpdateTimeTask is the object of runnable.

a)when the above call add the message in to the message queue.imm or after 5 sec.
b)How they are achieving 5 sec delay, Is there any thread running background ?
2.
Code:
private Runnable mUpdateTimeTask = new Runnable() {
                   public void run() {
                                }

                        }

a) will the above code create a thread, If yes , what would be the thread name and priority? If No, is it act as a Callback in this context?


Regards,
Gobi.S

Estgobi is offline  
Reply With Quote
Sponsors
Old November 26th, 2011, 05:42 PM   #2 (permalink)
Premium Member
 
Join Date: Oct 2011
Location: Sydney, Australia
Posts: 193
 
Device(s): Galaxy Nexus GSM
Thanks: 2
Thanked 37 Times in 33 Posts
Default

1.a) A timer is created. When the timer fires, the runnable will be added to the queue.
1.b) No background thread is created. Timers are provided by the Linux kernel.
2.a) Your runnable will run on the main thread.
jiminaus is offline  
Reply With Quote
The Following User Says Thank You to jiminaus For This Useful Post:
Estgobi (November 27th, 2011)
Reply

Bookmarks

Tags
runnable


Go Back   Android Forums > Android Development > Application Development > Developer 101 User CP
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -5. The time now is 08:17 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Custom vBulletin Skins by: Relivo