Streets,
Here is the snippet where I do the menuHandling:
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch( item.getItemId()){
case START_GAME:
gameThread.doStart();
return true;
case STOP_GAME:
gameThread.setState(gameThread.STATE_LOSE);
return true;
case PAUSE_GAME:
gameThread.pause();
return true;
case RESUME_GAME:
gameThread.unpause();
return true;
}
return super.onOptionsItemSelected(item);
}
Here is my doStart method:
public void doStart() {
synchronized (mSurfaceHolder) {
createShapes(mContext);
shape[0].visible = true;
score = 0;
mLastTime = System.currentTimeMillis() + 100;
setState(STATE_RUNNING);
}
}
Thanks,
Ayan
On Mar 12, 10:28 am, Streets Of Boston <[email protected]>
wrote:
> Could you provide a code-snippet showing how you coded themenu-
> handling and the starting of yourthread?
>
> On Mar 12, 10:00 am, Ikon <[email protected]> wrote:
>
> > Hi,
>
> > I am developing a game based on the SurfaceView/LunarLander example in
> > the sample code.
> > I have one activity, with onemenuoption that is "new game".
>
> > My activity listens for themenuselection, and once new game is
> > selected, doStart of the Gamethreadis called. The game starts up
> > after 3-4 seconds, but themenuoption sticks around on the screen
> > until the game has started. I think the mainthreadis waiting on the
> > doStart to do its thing, but since it's creating a newthread, how do
> > I get it to just start thethreadand continue its business of hiding
> > themenuoption right away, instead of after 3 seconds?
>
> > Thanks,
> > Ayan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---