[android-developers] Re: Activity Lifecycle question
Veritatis, yes, it is working fine :-) in fact, the only thing i changed was to include (override) the onBackPressed() method as it was posted. goBack() also remains as it was posted, calling finish() at the end, after calling setResult(RESULT_OK, rit). methods onPause, onStop, on destroy are not calling goBack anymore. another solution that i tested (... bad idea ...) succesfullly, was to eliminate any action once pressed the back button, which can be done by just calling return in the onBackPressed() method. if any one needs, i can post more detail of the source code. thanks again, for all of you guys ... On Aug 14, 12:29 am, Indicator Veritatis mej1...@yahoo.com wrote: Test thoroughly before you say it works. I have to say this because 1) the solution you describe still has a bad feel to it and 2) you TALK about calling finish(), but you don't show it in this latest post. Are you calling it from goBack()? As the last thing it does? On Aug 13, 8:21 pm, hectordu...@yahoo.com hectordu...@yahoo.com wrote: thank you guys, finally it works by overriding the back button, calling goBack() and also calling finish(). @Override public void onBackPressed() { goBack(); //return; }//onBackPressed hector On Aug 13, 12:00 pm, TreKing treking...@gmail.com wrote: On Sat, Aug 13, 2011 at 11:22 AM, hectordu...@yahoo.com hectordu...@yahoo.com wrote: i am trying to also do it form onPause(), onStop() , onDestroy . :- Well there's your problem. I don't know what will actually happen with you doing this, but that seems wrong. Those methods are already called when the user has backed out, so calling goBack() (and thus finish()) in them seem like it should be blowing your stack or ripping the time-space continuum. Don't call goBack() in those functions. If you need to set some result Intent data, do that, but don't call finish(). OR, override the back key (see the Android blog for info on this) to stop the current automatic finish(), then call your goBack() method. - TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- 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
[android-developers] Re: Activity Lifecycle question
i callled goBack() with sucess from a button: mButton_thisSpinValue.setOnLongClickListener(new View.OnLongClickListener() { public boolean onLongClick(View v) { Toast.makeText(HDART10Activity.this, GO BACK ..., Toast.LENGTH_SHORT).show(); goBack(); return true; }//onLongClick }); //clickListener i am trying to also do it form onPause(), onStop() , onDestroy . :- ( @Override public void onStop() { super.onStop(); goBack(); }//onStop thanks for help .. On Aug 12, 11:05 pm, TreKing treking...@gmail.com wrote: On Fri, Aug 12, 2011 at 5:36 PM, hectordu...@yahoo.com hectordu...@yahoo.com wrote: i wonder if somebody has an idea to deal with this issue; i tried to catch the RESULT_CANCELED but nothing happens, the activity 1 is as follows: How and where are you calling your goBack() method? - TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- 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
Re: [android-developers] Re: Activity Lifecycle question
On Sat, Aug 13, 2011 at 11:22 AM, hectordu...@yahoo.com hectordu...@yahoo.com wrote: i am trying to also do it form onPause(), onStop() , onDestroy . :- Well there's your problem. I don't know what will actually happen with you doing this, but that seems wrong. Those methods are already called when the user has backed out, so calling goBack() (and thus finish()) in them seem like it should be blowing your stack or ripping the time-space continuum. Don't call goBack() in those functions. If you need to set some result Intent data, do that, but don't call finish(). OR, override the back key (see the Android blog for info on this) to stop the current automatic finish(), then call your goBack() method. - TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- 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
[android-developers] Re: Activity Lifecycle question
thank you guys, finally it works by overriding the back button, calling goBack() and also calling finish(). @Override public void onBackPressed() { goBack(); //return; }//onBackPressed hector On Aug 13, 12:00 pm, TreKing treking...@gmail.com wrote: On Sat, Aug 13, 2011 at 11:22 AM, hectordu...@yahoo.com hectordu...@yahoo.com wrote: i am trying to also do it form onPause(), onStop() , onDestroy . :- Well there's your problem. I don't know what will actually happen with you doing this, but that seems wrong. Those methods are already called when the user has backed out, so calling goBack() (and thus finish()) in them seem like it should be blowing your stack or ripping the time-space continuum. Don't call goBack() in those functions. If you need to set some result Intent data, do that, but don't call finish(). OR, override the back key (see the Android blog for info on this) to stop the current automatic finish(), then call your goBack() method. - TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- 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
[android-developers] Re: Activity Lifecycle question
Test thoroughly before you say it works. I have to say this because 1) the solution you describe still has a bad feel to it and 2) you TALK about calling finish(), but you don't show it in this latest post. Are you calling it from goBack()? As the last thing it does? On Aug 13, 8:21 pm, hectordu...@yahoo.com hectordu...@yahoo.com wrote: thank you guys, finally it works by overriding the back button, calling goBack() and also calling finish(). @Override public void onBackPressed() { goBack(); //return; }//onBackPressed hector On Aug 13, 12:00 pm, TreKing treking...@gmail.com wrote: On Sat, Aug 13, 2011 at 11:22 AM, hectordu...@yahoo.com hectordu...@yahoo.com wrote: i am trying to also do it form onPause(), onStop() , onDestroy . :- Well there's your problem. I don't know what will actually happen with you doing this, but that seems wrong. Those methods are already called when the user has backed out, so calling goBack() (and thus finish()) in them seem like it should be blowing your stack or ripping the time-space continuum. Don't call goBack() in those functions. If you need to set some result Intent data, do that, but don't call finish(). OR, override the back key (see the Android blog for info on this) to stop the current automatic finish(), then call your goBack() method. - TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- 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
[android-developers] Re: Activity Lifecycle question
have Activity 1 use startActivityForResult() to start up Activity 2, with Activity 2 sending the result back via setResult(), followed by finish(). ok, thats exactly what the activities do; but the result back doesnt work when the hardware keyboarb (back) is used. What actvity 2 does is: public void goBack(){ rit = new Intent(); rit.putExtra(updatedYellowR, yellowR); rit.putExtra(updatedBlueR, blueR); rit.putExtra(updatedRedR, redR); setResult(RESULT_OK, rit); finish(); }//goBack yelllowR, blueR and redR are instances of the same class ... objects On Aug 12, 12:05 pm, Mark Murphy mmur...@commonsware.com wrote: On Fri, Aug 12, 2011 at 1:02 PM, hectordu...@yahoo.com hectordu...@yahoo.com wrote: Hi guys, My app has two activities with a parcelable object going forward and back between them, which works fine. The problem comes when user goes back (from activity 2 to main activity) by using the hardware keyboard. In that moment the method onStop suppose to be called and the activity must launch an intent in order to save results into the main activity, which doens not work :-( I wonder what i am doing wrong? ... Activity 2 should not launch an intent in order to save results into the main activity. If Activity 2 feels a bit like a dialog box (e.g., Please pick something out of this list), have Activity 1 use startActivityForResult() to start up Activity 2, with Activity 2 sending the result back via setResult(), followed by finish(). If Activity 2 is just some other activity (e.g., Please edit the thing you picked in Activity 1), then Activity 1 and Activity 2 should be sharing a real data model (database, content provider, etc.). -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Android Training...At Your Office:http://commonsware.com/training -- 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
Re: [android-developers] Re: Activity Lifecycle question
On Fri, Aug 12, 2011 at 1:16 PM, hectordu...@yahoo.com hectordu...@yahoo.com wrote: have Activity 1 use startActivityForResult() to start up Activity 2, with Activity 2 sending the result back via setResult(), followed by finish(). ok, thats exactly what the activities do; but the result back doesnt work when the hardware keyboarb (back) is used. It's not supposed to. If they press BACK, that means they are not choosing something. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Training...At Your Office: http://commonsware.com/training -- 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
[android-developers] Re: Activity Lifecycle question
:-( so, if the user press back, the method setResult(RESULT_OK, rit), called from onStop() ... does not work? On Aug 12, 12:35 pm, Mark Murphy mmur...@commonsware.com wrote: On Fri, Aug 12, 2011 at 1:16 PM, hectordu...@yahoo.com hectordu...@yahoo.com wrote: have Activity 1 use startActivityForResult() to start up Activity 2, with Activity 2 sending the result back via setResult(), followed by finish(). ok, thats exactly what the activities do; but the result back doesnt work when the hardware keyboarb (back) is used. It's not supposed to. If they press BACK, that means they are not choosing something. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Android Training...At Your Office:http://commonsware.com/training -- 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
Re: [android-developers] Re: Activity Lifecycle question
Try calling setResult from onPause - I believe onStop is too late, due to how Start/Stop/Pause/Resume are intermingled. 2011/8/12 hectordu...@yahoo.com hectordu...@yahoo.com: :-( so, if the user press back, the method setResult(RESULT_OK, rit), called from onStop() ... does not work? On Aug 12, 12:35 pm, Mark Murphy mmur...@commonsware.com wrote: On Fri, Aug 12, 2011 at 1:16 PM, hectordu...@yahoo.com hectordu...@yahoo.com wrote: have Activity 1 use startActivityForResult() to start up Activity 2, with Activity 2 sending the result back via setResult(), followed by finish(). ok, thats exactly what the activities do; but the result back doesnt work when the hardware keyboarb (back) is used. It's not supposed to. If they press BACK, that means they are not choosing something. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Android Training...At Your Office:http://commonsware.com/training -- 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 -- 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
Re: [android-developers] Re: Activity Lifecycle question
On Fri, Aug 12, 2011 at 2:12 PM, hectordu...@yahoo.com hectordu...@yahoo.com wrote: so, if the user press back, the method setResult(RESULT_OK, rit), called from onStop() ... does not work? Yes it does. More than likely you are handling onActivityResult incorrectly. Are you specifically checking for RESULT_OK? If so, then that's your problem. On back press, you will get RESULT_CANCELED instead. - TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- 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
Re: [android-developers] Re: Activity Lifecycle question
On Fri, Aug 12, 2011 at 3:17 PM, Kostya Vasilyev kmans...@gmail.com wrote: Try calling setResult from onPause - I believe onStop is too late, due to how Start/Stop/Pause/Resume are intermingled. Last I checked, even onPause() is too late. Hector: The idea is that you call setResult() when the user makes a choice (e.g., from onListItemClick() of a ListActivity). The BACK button is effectively like hitting Esc on a desktop dialog box, indicating that you didn't really want to make that choice in the first place. As TreKing notes in his reply he sent while I was typing this, onActivityResult() is called with RESULT_CANCELED, so you can detect this case. Any activity started via startActivityForResult() must be designed to allow users to say sorry, never mind. In fact, pretty much everything in Android needs to support sorry, never mind. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Training...At Your Office: http://commonsware.com/training -- 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
[android-developers] Re: Activity Lifecycle question
thank you guys for comments, i wonder if somebody has an idea to deal with this issue; i tried to catch the RESULT_CANCELED but nothing happens, the activity 1 is as follows: public void onActivityResult(int requestCode, int resultCode, Intent rit) { super.onActivityResult(requestCode, resultCode, rit); if (resultCode == RESULT_OK) { yellowRoullete = (Roullete) rit.getParcelableExtra(updatedYellowRoullete); blueRoullete = (Roullete) rit.getParcelableExtra(updatedBlueRoullete); redRoullete = (Roullete) rit.getParcelableExtra(updatedRedRoullete); }else if (resultCode == RESULT_CANCELED) { redButton.setText(hDART CANCELLED ...); Log.d(hDART, CANCELLLED); }else { redButton.setText(INTERACTION ERROR ...); Log.d(INTERACTION, ERROR); }//if } after the user press back (in activity 2), application goes back to activity 1 but result is lost ... same an ESC :-( ... yes, onResume() is also too late ... thanks for help... On Aug 12, 2:21 pm, Mark Murphy mmur...@commonsware.com wrote: On Fri, Aug 12, 2011 at 3:17 PM, Kostya Vasilyev kmans...@gmail.com wrote: Try calling setResult from onPause - I believe onStop is too late, due to how Start/Stop/Pause/Resume are intermingled. Last I checked, even onPause() is too late. Hector: The idea is that you call setResult() when the user makes a choice (e.g., from onListItemClick() of a ListActivity). The BACK button is effectively like hitting Esc on a desktop dialog box, indicating that you didn't really want to make that choice in the first place. As TreKing notes in his reply he sent while I was typing this, onActivityResult() is called with RESULT_CANCELED, so you can detect this case. Any activity started via startActivityForResult() must be designed to allow users to say sorry, never mind. In fact, pretty much everything in Android needs to support sorry, never mind. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Android Training...At Your Office:http://commonsware.com/training -- 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
[android-developers] Re: Activity Lifecycle question
Two questions: 1) why do you call super.onActivityResult()? The ApiDemo examples do not. If you must call it, you should call if after your own processing, since you want to catch the CANCELED first 2) what code DO you have for handling other result codes? You should have a default case at least so that you can put breakpoints there. On Aug 12, 3:36 pm, hectordu...@yahoo.com hectordu...@yahoo.com wrote: thank you guys for comments, i wonder if somebody has an idea to deal with this issue; i tried to catch the RESULT_CANCELED but nothing happens, the activity 1 is as follows: public void onActivityResult(int requestCode, int resultCode, Intent rit) { super.onActivityResult(requestCode, resultCode, rit); if (resultCode == RESULT_OK) { yellowRoullete = (Roullete) rit.getParcelableExtra(updatedYellowRoullete); blueRoullete = (Roullete) rit.getParcelableExtra(updatedBlueRoullete); redRoullete = (Roullete) rit.getParcelableExtra(updatedRedRoullete); }else if (resultCode == RESULT_CANCELED) { redButton.setText(hDART CANCELLED ...); Log.d(hDART, CANCELLLED); }else { redButton.setText(INTERACTION ERROR ...); Log.d(INTERACTION, ERROR); }//if } after the user press back (in activity 2), application goes back to activity 1 but result is lost ... same an ESC :-( ... yes, onResume() is also too late ... thanks for help... On Aug 12, 2:21 pm, Mark Murphy mmur...@commonsware.com wrote: On Fri, Aug 12, 2011 at 3:17 PM, Kostya Vasilyev kmans...@gmail.com wrote: Try calling setResult from onPause - I believe onStop is too late, due to how Start/Stop/Pause/Resume are intermingled. Last I checked, even onPause() is too late. Hector: The idea is that you call setResult() when the user makes a choice (e.g., from onListItemClick() of a ListActivity). The BACK button is effectively like hitting Esc on a desktop dialog box, indicating that you didn't really want to make that choice in the first place. As TreKing notes in his reply he sent while I was typing this, onActivityResult() is called with RESULT_CANCELED, so you can detect this case. Any activity started via startActivityForResult() must be designed to allow users to say sorry, never mind. In fact, pretty much everything in Android needs to support sorry, never mind. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Android Training...At Your Office:http://commonsware.com/training -- 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
[android-developers] Re: Activity Lifecycle question
1- i saw an example using super.onActivityResult() using it after the if didnt make any difference! 2-the process code is for RESULT_OK: yellowRoullete = (Roullete) rit.getParcelableExtra(updatedYellowRoullete); blueRoullete = (Roullete) rit.getParcelableExtra(updatedBlueRoullete); redRoullete = (Roullete) rit.getParcelableExtra(updatedRedRoullete); which means recovering the three instances which were returned from activity 2. thanks for comments On Aug 12, 6:36 pm, Indicator Veritatis mej1...@yahoo.com wrote: Two questions: 1) why do you call super.onActivityResult()? The ApiDemo examples do not. If you must call it, you should call if after your own processing, since you want to catch the CANCELED first 2) what code DO you have for handling other result codes? You should have a default case at least so that you can put breakpoints there. On Aug 12, 3:36 pm, hectordu...@yahoo.com hectordu...@yahoo.com wrote: thank you guys for comments, i wonder if somebody has an idea to deal with this issue; i tried to catch the RESULT_CANCELED but nothing happens, the activity 1 is as follows: public void onActivityResult(int requestCode, int resultCode, Intent rit) { super.onActivityResult(requestCode, resultCode, rit); if (resultCode == RESULT_OK) { yellowRoullete = (Roullete) rit.getParcelableExtra(updatedYellowRoullete); blueRoullete = (Roullete) rit.getParcelableExtra(updatedBlueRoullete); redRoullete = (Roullete) rit.getParcelableExtra(updatedRedRoullete); }else if (resultCode == RESULT_CANCELED) { redButton.setText(hDART CANCELLED ...); Log.d(hDART, CANCELLLED); }else { redButton.setText(INTERACTION ERROR ...); Log.d(INTERACTION, ERROR); }//if } after the user press back (in activity 2), application goes back to activity 1 but result is lost ... same an ESC :-( ... yes, onResume() is also too late ... thanks for help... On Aug 12, 2:21 pm, Mark Murphy mmur...@commonsware.com wrote: On Fri, Aug 12, 2011 at 3:17 PM, Kostya Vasilyev kmans...@gmail.com wrote: Try calling setResult from onPause - I believe onStop is too late, due to how Start/Stop/Pause/Resume are intermingled. Last I checked, even onPause() is too late. Hector: The idea is that you call setResult() when the user makes a choice (e.g., from onListItemClick() of a ListActivity). The BACK button is effectively like hitting Esc on a desktop dialog box, indicating that you didn't really want to make that choice in the first place. As TreKing notes in his reply he sent while I was typing this, onActivityResult() is called with RESULT_CANCELED, so you can detect this case. Any activity started via startActivityForResult() must be designed to allow users to say sorry, never mind. In fact, pretty much everything in Android needs to support sorry, never mind. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Android Training...At Your Office:http://commonsware.com/training -- 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
Re: [android-developers] Re: Activity Lifecycle question
On Fri, Aug 12, 2011 at 5:36 PM, hectordu...@yahoo.com hectordu...@yahoo.com wrote: i wonder if somebody has an idea to deal with this issue; i tried to catch the RESULT_CANCELED but nothing happens, the activity 1 is as follows: How and where are you calling your goBack() method? - TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- 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
[android-developers] Re: Activity Lifecycle Question
A situation you will often run in to is when another entity (such as the SearchManager or NotificationManager) starts one of your activities. In this case, the Intent.FLAG_ACTIVITY_NEW_TASK flag must be used, because the activity is being started outside of a task (and the application/task may not even exist). As described previously, the standard behavior in this situation is to bring to the foreground the current task matching the new activity's affinity and start the new activity at the top of it. There are, however, other types of behavior that you can implement. One common approach is to also use the Intent.FLAG_ACTIVITY_CLEAR_TOP flag in conjunction with NEW_TASK. By doing so, if your task is already running, then it will be brought to the foreground, all of the activities on its stack cleared except the root activity, and the root activity's onNewIntent(Intent) called with the Intent being started. Note that the activity often also use the singleTop or singleTask launch mode when using this approach, so that the current instance is given the new intent instead of requiring that it be destroyed and a new instance started. from http://code.google.com/android/intro/appmodel.html On Sep 29, 4:03 am, Gil [EMAIL PROTECTED] wrote: Awesome! You saved the day ... again. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Activity Lifecycle Question
When setting the Notification intent, are you using the Flags CLEAR_TOP and SINGLE_TASK? ie. Intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK) More explanation about these launch modes is given in the docs below: http://code.google.com/android/reference/android/content/Intent.html#FLAG_ACTIVITY_CLEAR_TOP 2008/9/28 Gil [EMAIL PROTECTED] I have an activity which is started by the intent set by my app in the status bar. My activity uses the singleTop launchMode. I go through the following sequence of events: 1) My activity is initially not visible. 2) I get a notification in the status bar. I click on the new notification which starts my activity. 3) While my activity is still visible I get a new notification in the status bar. I click on the new notification again. My question is the following: What method should I override to learn that my activity is being started when the user clicks on the notification the second time? I thought that onNewIntent should be called but it is not. onNewIntent does get called each time I click on the notification if my activity is initially started from the home screen (but not if it is initially started by clicking on the notification). --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Activity Lifecycle Question
Awesome! You saved the day ... again. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---