1

I am working on an app what I need is that whenever user press home while running the app and again resume to the app , it must start from the beginning login screen.

I have tried this : Answer from Resume after pressing 'Home' should start my Startactivity.

But it is not working .can any one help me?

Community
  • 1
  • 1
Navdroid
  • 4,453
  • 7
  • 29
  • 47
  • No..I still want a better solution!If I kill the process onRestart App doesnt work well it closes some screen itself – Navdroid Apr 28 '12 at 08:34

1 Answers1

0

According to your question you just have to call the login screen at onResume....


There are mainly two solutions of this problem....

  1. the best option is Override the home Button

  2. or you just have to kill all parent activities when home button clicked....

Override home button

See the First answer this will help u...

You can also do that at resume you have to check which activity was running when home button clicked so you have to kill that activity & start the login activity.. but this will be little complicated while overriding the home button is best option..

Community
  • 1
  • 1
SilentKiller
  • 6,944
  • 6
  • 40
  • 75
  • Overriding Home Button is not the thing that user want. You may further edit your answer to the exact requirement in the question. – Lalit Poptani Apr 27 '12 at 06:25
  • but in this question user wants to start or resume the app from login page so user should just kill all the activities n start the login or finish the app... n about home button overriding this is also a good idea to load the app or to resume the app from selected activity... – SilentKiller Apr 27 '12 at 06:27
  • Yes, but in your answer I can't see anything related to closing all the Activities. – Lalit Poptani Apr 27 '12 at 06:30
  • I only want to knoe how to kill all actvities – Navdroid Apr 27 '12 at 06:54
  • use this at onResume... android.os.Process.killProcess(android.os.Process.myPid()); – SilentKiller Apr 27 '12 at 06:56
  • In which activity I should use that ?? In one or all activities?? – Navdroid Apr 27 '12 at 06:59
  • Killing process forcefully is a bad way. – Lalit Poptani Apr 27 '12 at 07:00
  • u should write this at all activity where there is a possibility of home button clicked.... as the killing process forcefully is a bad way thats why i suggest to override the home button.... – SilentKiller Apr 27 '12 at 07:02