April 2015
Beginner to intermediate
494 pages
10h 26m
English
We are not done yet. Let's continue our example to handle activity events and log them to the LogCat view:
jni/EventLoop.cpp. Implement activate() and deactivate().Check both activity states before notifying the listener (to avoid untimely triggering). We consider an activity as activated only if a display window is available:... void EventLoop::activate() { // Enables activity only if a window is available. if ((!mEnabled) && (mApplication->window != NULL)) { mQuit = false; mEnabled = true; if (mActivityHandler.onActivate() != STATUS_OK) { goto ERROR; } } return; ERROR: mQuit = true; deactivate(); ANativeActivity_finish(mApplication->activity); } void EventLoop::deactivate() { if (mEnabled) ...