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 can
see:

@Override

    public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        setContentView(R.layout.main);

        handler=new Handler();


        myBanner = (BannerView) findViewById(R.id.gsBanner);

        ads.initialize(this, "mykey");

        accelerationTextView = (TextView) findViewById(R.id.acceleration);

        maxAccelerationTextView = (TextView)
findViewById(R.id.maxAcceleration);

        sensorManager = (SensorManager)
getSystemService(Context.SENSOR_SERVICE);



        Sensor accelerometer =
sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);

        sensorManager.registerListener(sensorEventListener, accelerometer,
SensorManager.SENSOR_DELAY_FASTEST);



        Timer updateTimer = new Timer("gForceUpdate");

        updateTimer.scheduleAtFixedRate(new TimerTask() {

        public void run(){

        updateGUI();

        }

        }, 0, 5);

        final Runnable r = new Runnable()

        {

            public void run()

            {

            handler.postDelayed(this, 10000);

            myBanner.refresh();

            }

        };


        handler.postDelayed(r, 10000);



    }


Does anything jump out at you?


Thanks

On Thu, Aug 18, 2011 at 4:32 PM, Mark Murphy <mmur...@commonsware.com>wrote:

> 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, 10000);
> >
> >             }
> >
> >         };
> >
> >         handler.postDelayed(r, 10000);
> >
> > It still doesn't work. It updates continuously, instead of the ten
> seconds I
> > specified.
>
> Either you are calling this too often (thereby scheduling lots of
> Runnables), or the problem lies in myBanner.refresh() somewhere.
>
> --
> 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
>



-- 
--------------------
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

Reply via email to