• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps how to set timer in android application

ritusingh

Lurker
Dec 11, 2009
2
0
Hi Frens,

can anyone please tel me how to set timer in android application?
i have followed the code given below but it is not responding-

Timer t=new Timer();
im1=new ImageView(this);
TimerTask t1=new TimerTask()
{
synchronized
public void run()
{
im1.setImageResource(R.drawable.b);
setContentView(im1);

}

};
t.schedule(t1, 2*1000);
this code is not working.
so please anybody help me out.

thanx-
Ritu Singh
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones