ActivityLog Test - Activity Terminated by User
This section provides a tutorial example on how to test activity lifecycle with the ActivityLog application in case user terminates the activity by clicking the return icon.
ActivityLog Test #1 - Run ActivityLog and terminate it immediately.
1. Click on the application icon on the emulator's home screen.
"ActivityLog" is listed in the application list.
2. Click on "ActivityLog" to start the application.
Message "Activity created" is displayed on the screen.
3. Click on the "return" button on the emulator control panel.
The application list is displayed again.
4. Run "adb shell" to view the log file:
# cat Activity.log
Sun Mar 01 19:03:56 2015: Checkpoint #1 - onCreate() called
Sun Mar 01 19:03:56 2015: Checkpoint #2 - onStart() called
Sun Mar 01 19:03:57 2015: Checkpoint #3 - onResume() called
Sun Mar 01 19:03:58 2015: Checkpoint #4 - onPause() called
Sun Mar 01 19:04:00 2015: Checkpoint #5 - onStop() called
Sun Mar 01 19:04:00 2015: Checkpoint #6b - onDestroyed() called
- My ActivityLog application is working!
- Clicking the "return" button on the emulator control panel terminates the current application
- The callback methods are called in a simple lifecycle in this sequence:
onStart(), onStart(), onResume(), onPause(), onStop(), and onDestroy().
Last update: 2015.
Table of Contents
About This Book
Installing JDK 1.8 on Windows System
Installation of Android SDK R24 and Emulator
Installing Apache Ant 1.9 on Windows System
Developing First Android Application - HelloAndroid
Android Application Package (APK) Files
Android Debug Bridge (adb) Tool
Android File Systems
Android 4.0.3 File Systems
AboutAndroid - Application to Retrieve System Information
►android.app.Activity Class and Activity Lifecycle
Introduction of Activity Lifecycle
onCreate() and Other Callback Methods
ActivityLog - Application to Create Log File
Viewing Activity Log File with "cat" Command in "adb shell"
Implementing Activity Callback Methods
►ActivityLog Test - Activity Terminated by User
ActivityLog Test - Activity Stopped and Restarted
ActivityLog Test - Activity Paused and Resumed
View Objects and Layout Resource Files
Using "adb logcat" Command for Debugging
Build Process and Package File Content
Building Your Own Web Browser
Android Command Line Shell
Samsung Galaxy Tab 3 Mini Tablet
USB Debugging Applications on Samsung Tablet
Android Tablet - LG-V905R
USB Debugging Applications on LG-V905R Tablet
Android Phone - LG-P925g
USB Debugging Applications on LG-P925g Phone
PDF Printing Version