I am editing the android game LunarLander.
I have made a java library which has a class named Calls to track
which contains various event functions which make web service calls.
I want to make a background to call some of these functions(which
works fine when run individually)
inside the above game. For example, I call newGame in the function
doStart()
i.e. whenever a new game starts.

For this background call I used a class extends AsyncTask -
        private class ng extends AsyncTask<Void,Void,Void> {
                protected Void doInBackground(Void... sample){
                        Calls Game = new Calls();
                        Game.calls_init(URL, authcode); //works fine
                        Game.newGame(gameId, gameName); // the game stops
unexpectedly
                        return null;
                }
        }
all the above variables are well defined.
I wrote this class inside the class LunarThread extends Thread.

And called it inside doStart() like this -
new ng().execute();

when i run the game in AVD its works fine for 2-3 secs then its stops
unexpectedly.
I want UI to run smoothly independent of these background calls but
that is not happening.
Why isn't the AsyncTask working? Is there any other method.

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