Android app timeout how to apply? when it minimized

362
January 13, 2017, at 11:31 AM

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.

Answer 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

Answer 2

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
}
READ ALSO
Zed camera with Android phone/tablet

Zed camera with Android phone/tablet

On the website it says that even though there is no SDK provided for android it is possible to connect it to the android device with a micro-USB adapterIs it possible to extract images from both cameras of ZED in this case? Is so, any code samples to accomplish...

530
chrome highlight text search tab

chrome highlight text search tab

Any suggestions about a library that provide the tab popup opens when highlighting a text on chrome, I haven't found any results on google and also I have seen it before but I don't remember where, If anyone just correct for me the topic I am searching...

360
How to programmatically add fragments in a loop to a single activity?

How to programmatically add fragments in a loop to a single activity?

Since I don't know how many views I need so I have to create them dynamicallyBased on my research that each fragment has to have a container, they can't share (Correct me if i'm wrong), so I need to create view container for each fragment dynamically,...

331
How to check if file is in downloadmanager queue?

How to check if file is in downloadmanager queue?

The user has to download multiple files which will start on a button clickThe code will check if a file already exists, if not then it adds it to the download queue

451