1. This work is licensed under the Apache 2.0 License
Prior Programming Experience Track: Session 3
Android Study Jams
Android Facilitator: Ritika Talukdar
2. This work is licensed under the Apache 2.0 License
Concept Overview
3. This work is licensed under the Apache 2.0 License
Understanding Activity and Activity
Lifecycle
● An activity is a screen on your devices which consists of the user interface.
● It provides a window in which the app draws it UI.
● An activity has different states like create, pause, stop, destroy, etc.
Class Activity
{
methods ------> Callbacks
methods
}
4. This work is licensed under the Apache 2.0 License
Main Activity Profile Activity Chat Activity
5. This work is licensed under the Apache 2.0 License
Activity Lifecycle
6. This work is licensed under the Apache 2.0 License
XML mainly uses tags to introduce elements into a layout, whether they’re views or viewgroups. A view is
basically any of the widgets that make up a typical utility app. Examples include:-
● Images (imageview)
● Text (textview)
● Editable text boxes (edittext)
● Buttons (button).
Introduction to XML
7. This work is licensed under the Apache 2.0 License
Hello World!
<TextView
android:text="Hello World!"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
OR
<TextView>
android:text="Hello World!"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
</TextView>
Declare layouts in XML
8.
9.
10. This work is licensed under the Apache 2.0 License
Conditions for Images
● The image should be of a small size, that is between 200 to 300 kb.
● The image should be in PNG format.
● The name of the image should be in a format like this: android_logo.png
● The name cannot have any capital letters, numbers, or special characters, except the
underscore.
11. This work is licensed under the Apache 2.0 License
Understanding fragments
A fragment represents a behaviour or a part of the user interface in an activity.
We can combine multiple fragments in a single activity to build a multi-pane UI.
12. This work is licensed under the Apache 2.0 License
Advantages of using fragments
● They take up lesser RAM than an activity. Hence, the app works faster with fragments than with
activities.
● They are reusable across multiple activities.
13. This work is licensed under the Apache 2.0 License
14. This work is licensed under the Apache 2.0 License
Share what you’ve
learnt with
#AndroidStudyJams, #dsc #igdtuw and
#DeveloperStudentClubs and tag
@googledevs, @GoogleStudents and
@DSCIGDTUW