Re: [android-developers] Update ad view every 30 seconds

2011-08-19 Thread Appaholics
No I got it working. The method Mark suggested was fine. Some error in R.java cause a resource on my sensor change to be reffered to as the same one, calling it again and again. I deleted R.java, had it recreated and now it is fine. Thanks On Fri, Aug 19, 2011 at 5:58 AM, TreKing

Re: [android-developers] Update ad view every 30 seconds

2011-08-19 Thread Mark Murphy
On Fri, Aug 19, 2011 at 3:16 AM, Appaholics raghavs...@appaholics.in wrote: No I got it working. The method Mark suggested was fine. Some error in R.java cause a resource on my sensor change to be reffered to as the same one, calling it again and again. I deleted R.java, had it recreated and

Re: [android-developers] Update ad view every 30 seconds

2011-08-19 Thread Appaholics
I use eclipse and the speed of my machine is not a problem (i7, 2.0 x 8 ghz) Thanks On Fri, Aug 19, 2011 at 4:15 PM, Mark Murphy mmur...@commonsware.comwrote: On Fri, Aug 19, 2011 at 3:16 AM, Appaholics raghavs...@appaholics.in wrote: No I got it working. The method Mark suggested was fine.

Re: [android-developers] Update ad view every 30 seconds

2011-08-19 Thread Jim Graham
On Fri, Aug 19, 2011 at 06:45:10AM -0400, Mark Murphy wrote: If you do command-line builds, I always recommend chaining clean onto your target list (e.g., ant clean install), unless you have a really big project and a really slow development machine. Alas, I don't know the equivalent in

Re: [android-developers] Update ad view every 30 seconds

2011-08-19 Thread Mark Murphy
On Fri, Aug 19, 2011 at 7:56 AM, Jim Graham spooky1...@gmail.com wrote: Would that equivalent be Project-Clean, which does a clean first, then builds (but by default, does so for every project in Eclipse)? Sorry -- I meant I didn't know how to do that on every build. Yes, that's how you clear

Re: [android-developers] Update ad view every 30 seconds

2011-08-19 Thread Jim Graham
On Fri, Aug 19, 2011 at 08:02:47AM -0400, Mark Murphy wrote: On Fri, Aug 19, 2011 at 7:56 AM, Jim Graham spooky1...@gmail.com wrote: Would that equivalent be Project-Clean, which does a clean first, then builds (but by default, does so for every project in Eclipse)? Sorry -- I meant I

[android-developers] Update ad view every 30 seconds

2011-08-18 Thread Appaholics
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, 3); However, it refreshes every half second or

Re: [android-developers] Update ad view every 30 seconds

2011-08-18 Thread Mark Murphy
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

Re: [android-developers] Update ad view every 30 seconds

2011-08-18 Thread Appaholics
I am only scheduling two timers, both using different names etc. I'll look into using postDelayed(); Thanks On Thu, Aug 18, 2011 at 4:13 PM, Mark Murphy mmur...@commonsware.comwrote: Why not use postDelayed()? It saves you a background thread, and your Runnable gets invoked on the main

Re: [android-developers] Update ad view every 30 seconds

2011-08-18 Thread Appaholics
I tried using a postDelayed like this: final Runnable r = new Runnable() { public void run() { myBanner.refresh(); handler.postDelayed(this, 1); } }; handler.postDelayed(r, 1); It still

Re: [android-developers] Update ad view every 30 seconds

2011-08-18 Thread Mark Murphy
On Thu, Aug 18, 2011 at 6:55 AM, Appaholics raghavs...@appaholics.in wrote: I tried using a postDelayed like this:         final Runnable r = new Runnable()         {             public void run()             {             myBanner.refresh();             handler.postDelayed(this,

Re: [android-developers] Update ad view every 30 seconds

2011-08-18 Thread Appaholics
I am using the greystripe SDK, for which I need to call myBanner.refresh();. the same call works fine in another one of my apps when I call it at game over. However, here there is no moment at which I can call it and hence must run it every 10 seconds. I only call the runnable in onCreate as you

Re: [android-developers] Update ad view every 30 seconds

2011-08-18 Thread Mark Murphy
Nothing obvious. Create yourself a scrap project that just does the postDelayed() quasi-loop, logging to LogCat. You should see it simply show up every 10 seconds. On Thu, Aug 18, 2011 at 7:08 AM, Appaholics raghavs...@appaholics.in wrote: I am using the greystripe SDK, for which I need to call

Re: [android-developers] Update ad view every 30 seconds

2011-08-18 Thread TreKing
This might help: http://developer.android.com/resources/articles/timed-ui-updates.html - TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered