how to use timer class in android application

Put your problem here if it does not fit any of the other categories.

how to use timer class in android application

Postby ritusingh1 » Tue Dec 22, 2009 10:08 am

Hello frens,

Can anyone please tel me how to implement timer class in android.
i am using timer and timertask both the classes and in timer class
there is a method schedule which i am using but result is not obtained.
here is the following code-
Timer t=new Timer();
TimerTask t1=new TimerTask()
{
public void run()
{
Intent i=new Intent(Context package,abc.class);
startActivity(i);




}

};
t.schedule(t1,2*1000);

i want after 2 seconds next task shud be performed
but it is not happening.can anyone please help me out
like what will be the solution.

thanx-
Ritu Singh
ritusingh1
Freshman
Freshman
 
Posts: 3
Joined: Tue Dec 22, 2009 9:52 am

Top

Reply

Postby DestinyRules » Tue Dec 22, 2009 12:56 pm

Hi Ritu!

may be u hve not using same BundleID in both activity,thats why control is not moving under run().

thnks
DestinyRules
Freshman
Freshman
 
Posts: 3
Joined: Tue Dec 22, 2009 9:09 am

reply

Postby ritusingh1 » Tue Dec 22, 2009 12:58 pm

thanx neha for replying......
my code is working now.
ritusingh1
Freshman
Freshman
 
Posts: 3
Joined: Tue Dec 22, 2009 9:52 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 15 guests