Why not use postDelayed()? It saves you a background thread, and your
Runnable gets invoked on the main application thread (which will be
necessary eventually for updating the ImageView or whatever the ad
banner is).

I haven't used Timer/TimerTask on Android. Nothing leaps out at me as
being an issue with the code snippet, other than the background
thread. Are you sure you're not accidentally scheduling lots of
timers?

On Thu, Aug 18, 2011 at 6:36 AM, Appaholics <raghavs...@appaholics.in> wrote:
> Hi,
> I am using the following to refresh my ad view every 30 seconds:
>
> Timer adTimer = new Timer("adUpdate");
>
>         adTimer.scheduleAtFixedRate(new TimerTask() {
>
>         public void run(){
>
>         myBanner.refresh();
>
>         }
>
>         }, 0, 30000);
>
> However, it refreshes every half second or so, if the LogCat output is to be
> believed. What is wrong in my code. The app doesn't crash but the update
> time isn't right.
>
> Thanks
>
> --
> --------------------
> Raghav Sood
> CEO/Founder/Owner/Dictator/Tyrant at Appaholics (Basically all titles
> required to have complete control)
> http://www.raghavsood.com/
> https://market.android.com/developer?pub=Appaholics
> http://www.appaholics.in/
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en



-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Warescription: Three Android Books, Plus Updates, One Low Price!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to