BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 08-25-2010, 03:33 AM   #1
longmilk
New Member
 
Join Date: Jun 2010
Model: 9000
PIN: N/A
Carrier: Viettel
Posts: 4
Default Question about Thread?

Please Login to Remove!

I'm developing an application that automatically check mail every 10 minutes (like Gmail). I've used background checkMailThread, it executes every 10 minutes. I don't know how Thread.sleep() will effect the CPU and does this Thread drains my battery?
Posted via BlackBerryForums.com Mobile
Offline  
Old 08-25-2010, 04:08 AM   #2
vivartpandey
Thumbs Must Hurt
 
Join Date: Jun 2008
Model: 9000
Carrier: Airtel
Posts: 81
Default

instead of sleep use timertask.

Code:
Timer timer = new Timer();
			TimerTask timerTask = new TimerTask(){

				public void run() {
					// check email
					
				}
				
			};
			timer.scheduleAtFixedRate(timerTask, 1000, 10*60*1000);
__________________
blog.vimviv.com
Offline  
Old 08-25-2010, 04:38 AM   #3
longmilk
New Member
 
Join Date: Jun 2010
Model: 9000
PIN: N/A
Carrier: Viettel
Posts: 4
Default

Quote:
Originally Posted by vivartpandey View Post
instead of sleep use timertask.

Code:
Timer timer = new Timer();
			TimerTask timerTask = new TimerTask(){

				public void run() {
					// check email
					
				}
				
			};
			timer.scheduleAtFixedRate(timerTask, 1000, 10*60*1000);
TimerTask drains less battery and CPU, is it true?
Posted via BlackBerryForums.com Mobile
Offline  
Old 08-25-2010, 06:37 AM   #4
Dubdub
Appleinator
 
Dubdub's Avatar
 
Join Date: Nov 2005
Location: New Hampshire
Model: App6+
OS: AJBR549
PIN: Ask
Carrier: ATT & Verizon
Posts: 20,038
Default

What is your planned use? RIM does this automatically now.
__________________
-->>BB FAQ

-->>Stinsonddog's Tip Site!

-->>Twitter


If someone helps, tell them by clicking the Thanks button.!!
Offline  
Closed Thread



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

Forum Jump


APPLE 630-0895-B  VRAM 128K X 8 BOARD CARD VINTAGE picture

APPLE 630-0895-B VRAM 128K X 8 BOARD CARD VINTAGE

$74.77



APPLE 820-0522-A 630-0895-B LITE VRAM 128K X 8 BOARD  picture

APPLE 820-0522-A 630-0895-B LITE VRAM 128K X 8 BOARD

$149.99



128K RAM - APPLE - ORIGINAL APPLE prototype BOARD picture

128K RAM - APPLE - ORIGINAL APPLE prototype BOARD

$408.75







Copyright © 2004-2016 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.