1

I want to make a exam app I want to apply a feature in my app in this feature when student minimize app then exam will automatically cancelled. so they can't cheat so please tell me what will and how will I do this in Android app in adt.

2 Answers2

1

In your exam activity, override onPause() and paste cancel exam method before super.onPause().

Edit: I think you need onPause() instead of onStop(). Learn more about Activity Life cycle

enter image description here

Harry T.
  • 3,478
  • 2
  • 21
  • 41
0

When you minimize app, onStop will called.

Called when you are no longer visible to the user

So inside onStop you can cancel the example

@Override
protected void onStop() {
    super.onStop();
    // cancel exam here
}
Linh
  • 57,942
  • 23
  • 262
  • 279