-1

I have developed an app that stores all private data information hence I develop password protected screen.

When I open the app the password screen comes up properly but after logging in and if I am editing anything and then I press the home button I have an issue the app reopens to protected screen without the password.

How do I send it back to password screen onResume?

I need to figure out a way to get Home button pressed on Fragment and activity? Or is there a better option?

Can somebody help me figure this out?

Thanks!

Sanjana Nair
  • 2,663
  • 6
  • 26
  • 44
  • What about calling 'finish()' in 'onPause()' ? Or alternatively replace the actual Fragment with the password Fragment in 'onRestart()' ? – momo Jun 11 '15 at 07:14

2 Answers2

0

When you call onPause and onDestroy, automatically log out of the server with that username + password. And then every time you log on make it check to see if you are connected/logged in to the server, if you are not (Which will always be the case) then switch to the login activity. Hope this helped. :)

Grobbed
  • 317
  • 2
  • 12
  • What happens is when I press Home Button and then click recent button on my phone and then open the app. The protected screen comes up but I need to show password screen? – Sanjana Nair Jun 11 '15 at 05:31
  • Change the activity to the Password screen on every onResume (A method that is called every time the activity is opened) – Grobbed Jun 11 '15 at 23:59
0

You need to override Android inbuild method onSaveInstanceState(Bundle savedInstanceState). This is more easy and work well.

Saving Android Activity state using Save Instance State

Community
  • 1
  • 1
Nandan Singh
  • 1,089
  • 12
  • 13