I got this working by putting the intent code in onServiceDisconnected

On Oct 26, 11:21 pm, jax <jackma...@gmail.com> wrote:
> I am trying to make it so that when a user exits an activity or flips
> the screen it will continue the last session.  I am binding to a
> service.
>
> If the user presses a particular button with an intent action of
> Constants.NEW_GAME it will create a whole new session destroying the
> previous session.  Below is my onBind method, the problem is that when
> I run this, startNewGame() runs as expected but for some reason when
> the activity is loaded there is no data.  When I comment out
> intent.setAction the data is visible, but, the game resets itself when
> I flip the phone screen out!  What is going on here?
>
> THIS DOES NOT WORK
>
>         @Override
>         public IBinder onBind(Intent intent) {
>
>                 Log.i(TAG,"Binding to QuestionsService successful");
>
>                 if(intent.getAction().equals(Constants.NEW_GAME)) {
>                         //We need to create a whole new game which will end 
> the previouse
> game
>                         startNewGame();
>                         intent.setAction(Constants.CONTINUE_GAME);
>                 }
>
>                 return mBinder;
>         }
>
> THIS DOES WORK (but the game resets when the user flips the screen)
>
>         @Override
>         public IBinder onBind(Intent intent) {
>
>                 Log.i(TAG,"Binding to QuestionsService successful");
>
>                 if(intent.getAction().equals(Constants.NEW_GAME)) {
>                         //We need to create a whole new game which will end 
> the previouse
> game
>                         startNewGame();
> //                      intent.setAction(Constants.CONTINUE_GAME);
>                 }
>
>                 return mBinder;
>         }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to