I could also uncover hax, which I am now using to solve my problem. In the "pre-logged in" actions, I set this in the manifest:
android:noHistory="true"
Then in every action I have this code:
public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { Intent intent = new Intent(MyActivity.this, ParentActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); startActivity(intent); return true; } return super.onKeyDown(keyCode, event); }
FLAG_ACTIVITY_NO_ANIMATION only works on phones with API level 5 or higher, but what it does is that instead of “open new activity”, the animation plays “return to previous activity” (at least on the droid and communication) . This prevents the confusion of the appearance of a new action when the user presses the back button.
This solution is not perfect. On phones with an API level lower than 5, the animation becomes incorrect. Also, it is not super neat and requires more code than I prefer. However, it works ...
pgsandstrom
source share