Itp107 Reviewer
Itp107 Reviewer
Strings File
● The strings.xml file is located in the
res/values folder and it contains all
the text that your application uses.
R File
● The gen/com.example.helloworld/R
.java file is the glue between the
ANDROID ACTIVITIES
activity Java files like
● Android applications (or
MainActivity.java and the resources
simply “apps”) are software
like strings.xml.
programs that are installed
Layout File
and run natively on Android
● The activity_main.xml is a layout file
devices.
available in the res/layout directory
Android Activity Life Cycle
that is referenced by your application
when building its interface.
Different Resources folder
● The onStop method should be
used to pause or stop animations,
threads, Sensor listeners, GPS
lookups, Timers, Services, or other
processes that are used exclusively
to update the UI.
● The onRestart method is called
immediately prior to all but the first
call to onStart. Use it to implement
special processing that you want
done only when the Activity restarts
within its full lifetime.
The Active Lifetime
● The active lifetime starts with a call
to onResume and ends with a
Activity State corresponding call to onPause.
Active ● An active Activity is in the
● When an Activity is at the highest of foreground and is receiving user
the stack it is the visible, focused, input events.
foreground Activity that is receiving Process Priority
user input. Active processes (Top Priority)
Paused ● Active (foreground) processes have
● Activity is going to be visible but will application components the user is
not have focus; at this time it’s interacting with.
paused. Active processes include one or more of the
Stopped following components:
● When an Activity isn’t visible, it ● Activities in an active state—that is,
“stops.” those in the foreground responding
Inactive to user events.
● After an Activity has been killed, as ● You explore Activity states in greater
well as before it’s been launched, it’s detail later in this chapter.
inactive. ● Broadcast Receivers executing
● Activities have been removed from onReceive event handlers.
the Activity stack and need to be ● Services executing onStart,
restarted before they can be onCreate, or onDestroy event
displayed and used. handlers.
Activity Lifetimes Visible processes (High Priority)
The Full Lifetime ● Visible but inactive processes are
● the full lifetime of your Activity those hosting “visible” Activities or
occurs between the first call to foreground Services.
onCreate and when it is destroyed. Started background Service processes
The Visible Lifetime (Medium Priority)
● Activity's visible lifetimes are ● Processes hosting background
bounded between calls to onStart Services that have been started.
and onStop.
Because these Services don’t
interact directly with the user, they
receive a slightly lower priority than
visible Activities or foreground
Services
Background processes (Low Priority)
● Processes hosting Activities that
aren’t visible and that don’t have any
running Services.